当前位置: 首页>>代码示例>>Python>>正文


Python yoyo.step函数代码示例

本文整理汇总了Python中yoyo.step函数的典型用法代码示例。如果您正苦于以下问题:Python step函数的具体用法?Python step怎么用?Python step使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了step函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: step

"""
After applying all migrations create views.
"""

from yoyo import step
step(
    "CREATE VIEW `apiary_website_logs_summary` AS \
        SELECT `apiary_website_logs`.`website_id` AS `website_id`, \
            count(0) AS `log_count`, \
            max(`apiary_website_logs`.`log_date`) AS `log_date_last`, \
            min(`apiary_website_logs`.`log_date`) AS `lot_date_first` \
            FROM `apiary_website_logs` \
            GROUP BY `apiary_website_logs`.`website_id`;",
    "DROP VIEW IF EXISTS `apiary_website_logs_summary`;"
)
开发者ID:WikiApiary,项目名称:WikiApiary,代码行数:15,代码来源:post-apply.py

示例2: step

from yoyo import step

step("""
CREATE TABLE movements (
  id     SERIAL,
  token  VARCHAR,
  amount BIGINT
);
    """,
    """DROP TABLE movements;""")
开发者ID:NinjaDevelper,项目名称:accounts,代码行数:10,代码来源:0004-create-movements.py

示例3: step

"""
Add not-null col in Ad
"""

from yoyo import step

__depends__ = {'20151208_02_dPGPe-rename-currencys-col-in-ad'}

steps = [
    step("ALTER TABLE ad CHANGE COLUMN site site VARCHAR(30) NOT NULL"),
    step("DELETE FROM ad WHERE site_id is NULL"),
    step("ALTER TABLE ad CHANGE COLUMN site_id site_id VARCHAR(100) NOT NULL"),
    step("ALTER TABLE ad CHANGE COLUMN country country VARCHAR(2) NOT NULL"),
]
开发者ID:jplusplus,项目名称:rentswatch-scraper,代码行数:14,代码来源:20151217_01_mGj93-add-not-null-col-in-ad.py

示例4: step

"""
Store the raw statistics collected from SMW.

This migration implements part of the manually created Apiary DB
that WikiApiary launched with.
"""

from yoyo import step
step(
    "CREATE TABLE `smwinfo` ( \
        `website_id` int(11) NOT NULL, \
        `capture_date` datetime NOT NULL, \
        `response_timer` float DEFAULT NULL, \
        `propcount` bigint(20) NOT NULL, \
        `proppagecount` int(11) NOT NULL, \
        `usedpropcount` int(11) NOT NULL, \
        `declaredpropcount` int(11) NOT NULL, \
        `querycount` int(11) DEFAULT NULL, \
        `querysize` int(11) DEFAULT NULL, \
        `conceptcount` int(11) DEFAULT NULL, \
        `subobjectcount` int(11) DEFAULT NULL, \
        PRIMARY KEY (`website_id`,`capture_date`) \
    ) ENGINE=InnoDB DEFAULT CHARSET=utf8",
    "DROP TABLE `smwinfo`",
    ignore_errors='rollback', # This table is dropped in migration 20.
)
开发者ID:WikiApiary,项目名称:WikiApiary,代码行数:26,代码来源:0006.create-smwinfo.py

示例5: transaction

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
        )""")
)
开发者ID:binrush,项目名称:thousands,代码行数:11,代码来源:007.summits_images.py

示例6: step

from yoyo import step

step(
    """
    ALTER TABLE User ADD COLUMN registerDate timestamp not null default current_timestamp
    """,

    "ALTER TABLE User DROP COLUMN registerDate",
)
开发者ID:zachwick,项目名称:hwpc,代码行数:9,代码来源:2016_02_14_000_add_registerdate_to_user.py

示例7: step

from yoyo import step

step(
    "CREATE TABLE IF NOT EXISTS softban_log (status text, source text, dated datetime DEFAULT CURRENT_TIMESTAMP)"
)
开发者ID:Gurzeh,项目名称:PokemonGo-Bot,代码行数:5,代码来源:softban_log.py

示例8: transaction

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'")
)
开发者ID:binrush,项目名称:thousands,代码行数:14,代码来源:006.vk_dummy_photos.py

示例9: step

"""Create media migration"""
# pylint: disable=C0103

#
# file: migrations/0002.create-media.py
#
from yoyo import step

step(
    """
    CREATE TABLE media
    (
        id serial,
        media_id text NOT NULL,
        media_created_time timestamp NOT NULL,
        data json NOT NULL,
        created_at timestamp with time zone NOT NULL,
        updated_at timestamp with time zone,
        CONSTRAINT pk_media PRIMARY KEY (id),
        CONSTRAINT uq_media_id UNIQUE (media_id)
    )
    """,
    "DROP TABLE IF EXISTS media CASCADE;",
)
开发者ID:Smotko,项目名称:hipster-frame,代码行数:24,代码来源:0002.create-media.py

示例10: step

"""
Add description to Ad
"""

from yoyo import step

__depends__ = {'20151217_01_mGj93-add-not-null-col-in-ad'}

steps = [
    step("ALTER TABLE ad ADD description TEXT"),
]
开发者ID:jplusplus,项目名称:rentswatch-scraper,代码行数:11,代码来源:20160324_01_30zI3-add-description-to-ad.py

示例11: step

from yoyo import step

step("""
UPDATE nodes
SET is_input=1
WHERE rowid
IN (SELECT input FROM nodes_to_nodes)
""")
step("""
UPDATE nodes
SET is_response=1
WHERE rowid
IN (SELECT response FROM nodes_to_nodes)
""")

''' #this doesn't work in sqlite
step("""UPDATE nodes n 
JOIN nodes_to_nodes n2n 
  ON n.rowid=n2n.response
SET n.is_response=1""",
     "UPDATE nodes SET is_response=0")
step("""UPDATE nodes n 
JOIN nodes_to_nodes n2n 
  ON n.rowid=n2n.input
SET n.is_input=1""",
     "UPDATE nodes SET is_input=0")
'''
开发者ID:serversquared,项目名称:VirtualMimic,代码行数:27,代码来源:0003-populate-is-fields.py

示例12: step

that WikiApiary launched with.
"""

from yoyo import step
step(
    "CREATE TABLE `statistics_daily` ( \
        `website_id` int(11) NOT NULL, \
        `website_date` date NOT NULL, \
        `users_min` bigint(20) NOT NULL, \
        `users_max` bigint(20) NOT NULL, \
        `activeusers_max` bigint(20) NOT NULL, \
        `admins_max` bigint(20) NOT NULL, \
        `articles_min` bigint(20) NOT NULL, \
        `articles_max` bigint(20) NOT NULL, \
        `edits_min` bigint(20) NOT NULL, \
        `edits_max` bigint(20) NOT NULL, \
        `jobs_max` bigint(20) NOT NULL, \
        `pages_min` bigint(20) NOT NULL, \
        `pages_max` bigint(20) NOT NULL, \
        `pages_last` bigint(20) NOT NULL, \
        `views_min` bigint(20) NOT NULL, \
        `views_max` bigint(20) NOT NULL, \
        `smw_propcount_min` bigint(20) NOT NULL, \
        `smw_propcount_max` bigint(20) NOT NULL, \
        `smw_proppagecount_last` int(11) NOT NULL, \
        `smw_usedpropcount_last` int(11) NOT NULL, \
        `smw_declaredpropcount_last` int(11) NOT NULL, \
        PRIMARY KEY (`website_id`,`website_date`) \
    ) ENGINE=InnoDB DEFAULT CHARSET=utf8",
    "DROP TABLE `statistics_daily`",
)
开发者ID:WikiApiary,项目名称:WikiApiary,代码行数:31,代码来源:0008.create-statistics-daily.py

示例13: step

from yoyo import step

step(
    '''CREATE TABLE IF NOT EXISTS loc (
        id INTEGER PRIMARY KEY AUTOINCREMENT,
        name VARCHAR(50) UNIQUE NOT NULL,
        map UNIQUE NOT NULL,
        phone INTEGER UNIQUE NOT NULL,
        fax INTEGER UNIQUE NOT NULL,
        address TEXT UNIQUE NOT NULL,
        city TEXT UNIQUE NOT NULL,
        zipcode INTEGER UNIQUE NOT NUll,
        state TEXT UNIQUE NOT NULL,
        email TEXT UNIQUE NOT NULL)''',
    '''DROP TABLE IF EXISTS loc''',
)
开发者ID:cdaug,项目名称:AbelsonMechanical,代码行数:16,代码来源:20160113111355-create-loc.py

示例14: step

"""
Logging table to keep log entries for related to a specific
website.

This migration implements part of the manually created Apiary DB
that WikiApiary launched with.
"""

from yoyo import step
step(
    "CREATE TABLE `apiary_website_logs` ( \
        `log_id` int(11) NOT NULL AUTO_INCREMENT, \
        `website_id` int(11) NOT NULL, \
        `log_date` datetime NOT NULL, \
        `website_name` varchar(255) NOT NULL, \
        `log_type` varchar(30) NOT NULL, \
        `log_severity` varchar(30) NOT NULL, \
        `log_message` varchar(255) NOT NULL, \
        `log_bot` varchar(30) DEFAULT NULL, \
        `log_url` varchar(255) DEFAULT NULL, \
        PRIMARY KEY (`log_id`), \
        KEY `idx_log_date` (`log_date`) USING BTREE, \
        KEY `idx_website_id_log_date` (`website_id`,`log_date`) USING BTREE \
    ) ENGINE=InnoDB DEFAULT CHARSET=utf8",
    "DROP TABLE `apiary_website_logs`",
)
开发者ID:WikiApiary,项目名称:WikiApiary,代码行数:26,代码来源:0002.create-apiary-website-logs.py

示例15: step

from yoyo import step

step("""
CREATE TABLE prices (
  id     SERIAL,
  bytes  BIGINT,
  amount BIGINT
);
    """,
    """DROP TABLE prices;""")
开发者ID:NinjaDevelper,项目名称:accounts,代码行数:10,代码来源:0005-create-prices.py


注:本文中的yoyo.step函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。