from yoyo import step, transaction

# Removing dummy images downloaded from vk.com as user pictures
# due to bug in vk_get_user and replacing them with NULL to user
# our dummy images instead;

transaction(
    step("UPDATE users SET image=NULL, preview=NULL " +
         "WHERE image='29a62e8bc3609aef88ac2bc722bf7c71f4f86a32.png'"),
    step("DELETE FROM images WHERE " +
         "name='29a62e8bc3609aef88ac2bc722bf7c71f4f86a32.png'"),
    step("DELETE FROM images WHERE " +
         "name='1fc78e0df8d470a82ed55882ac619e7aafa68051.png'"))
from yoyo import step, transaction

transaction(
    step("""CREATE TABLE summits_images (
        image varchar(64) PRIMARY KEY,
        preview varchar(64) NOT NULL,
        summit_id integer REFERENCES summits(id),
        main boolean DEFAULT false,
        comment text DEFAULT NULL
        )""")
)
Beispiel #3
0
from yoyo import step, transaction

transaction(step("ALTER TABLE users DROP COLUMN location"),
            step("ALTER TABLE users DROP COLUMN about"),
            step("ALTER TABLE users DROP COLUMN pub"))
Beispiel #4
0
from yoyo import step, transaction

transaction(step("ALTER TABLE users ADD COLUMN about text DEFAULT NULL"), )
Beispiel #5
0
from yoyo import step, transaction

transaction(step("ALTER TABLE ridges RENAME COLUMN type TO type_"))
from yoyo import step, transaction

# Removing dummy images downloaded from vk.com as user pictures
# due to bug in vk_get_user and replacing them with NULL to user
# our dummy images instead;

transaction(
    step("UPDATE users SET image=NULL, preview=NULL " +
         "WHERE image='29a62e8bc3609aef88ac2bc722bf7c71f4f86a32.png'"),
    step("DELETE FROM images WHERE " +
         "name='29a62e8bc3609aef88ac2bc722bf7c71f4f86a32.png'"),
    step("DELETE FROM images WHERE " +
         "name='1fc78e0df8d470a82ed55882ac619e7aafa68051.png'")
)
Beispiel #7
0
from yoyo import step, transaction

transaction(
    step("ALTER TABLE users DROP COLUMN email"),
    step("ALTER TABLE users RENAME COLUMN img_id TO image_id"),
    step("ALTER TABLE users " +
         "ADD COLUMN preview_id integer REFERENCES images(id)"),
    step("ALTER TABLE users ADD COLUMN location varchar(256)"),
)
from yoyo import step, transaction

transaction(
    step("ALTER TABLE summits ADD COLUMN coordinates point"),
    step("UPDATE summits SET coordinates=point(lat, lng)"),
    step("ALTER TABLE summits DROP COLUMN lat"),
    step("ALTER TABLE summits DROP COLUMN lng"),
    step("ALTER TABLE summits ALTER COLUMN coordinates SET NOT NULL")
)
Beispiel #9
0
from yoyo import step, transaction

transaction(
    step("""CREATE TABLE summits_images (
        image varchar(64) PRIMARY KEY,
        preview varchar(64) NOT NULL,
        summit_id integer REFERENCES summits(id),
        main boolean DEFAULT false,
        comment text DEFAULT NULL
        )"""))
from yoyo import step, transaction

transaction(step("ALTER TABLE climbs ADD COLUMN year integer DEFAULT NULL"),
            step("ALTER TABLE climbs ADD COLUMN month integer DEFAULT NULL"),
            step("ALTER TABLE climbs ADD COLUMN day integer DEFAULT NULL"),
            step("UPDATE climbs SET year = EXTRACT(YEAR FROM ts)"),
            step("UPDATE climbs SET month = EXTRACT(MONTH FROM ts)"),
            step("UPDATE climbs SET day = EXTRACT(DAY FROM ts)"),
            step("ALTER TABLE climbs DROP COLUMN ts"))
Beispiel #11
0
from yoyo import step, transaction

transaction(
    step("ALTER TABLE users DROP COLUMN location"),
    step("ALTER TABLE users DROP COLUMN about"),
    step("ALTER TABLE users DROP COLUMN pub")
)
Beispiel #12
0
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.


from yoyo import step, transaction


transaction(
step(
    'CREATE TABLE items ('
    '   id INTEGER UNIQUE PRIMARY KEY, '
    '   uri VARCHAR UNIQUE NOT NULL, '
    '   musicbrainz_id VARCHAR '
    ')',
    'DROP TABLE items'
),
step(
    'CREATE TABLE plays ('
    '   id INTEGER UNIQUE PRIMARY KEY,'
    '   datetime DATETIME NOT NULL,'
    '   item_id INTEGER NOT NULL,'
    '   FOREIGN KEY (item_id) REFERENCES items(id)'
    ')',
    'DROP TABLE plays'
)
)
from yoyo import step, transaction

transaction(
    step("ALTER TABLE climbs ADD COLUMN year integer DEFAULT NULL"),
    step("ALTER TABLE climbs ADD COLUMN month integer DEFAULT NULL"),
    step("ALTER TABLE climbs ADD COLUMN day integer DEFAULT NULL"),
    step("UPDATE climbs SET year = EXTRACT(YEAR FROM ts)"),
    step("UPDATE climbs SET month = EXTRACT(MONTH FROM ts)"),
    step("UPDATE climbs SET day = EXTRACT(DAY FROM ts)"),
    step("ALTER TABLE climbs DROP COLUMN ts"),
)
Beispiel #14
0
from yoyo import step, transaction

transaction(
    step("ALTER TABLE ridges ADD COLUMN image varchar(64)"),
    step("ALTER TABLE ridges ADD COLUMN panoram varchar(64)"),
    step("ALTER TABLE ridges ADD COLUMN type text"),
    step("UPDATE ridges SET type='Хребет'")
)
from yoyo import step, transaction

transaction(
    step("ALTER TABLE users ADD COLUMN about text DEFAULT NULL"),
)