Here are the examples of the python api sqlalchemy.DateTime taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
221 Examples
3
Source : db.py
with MIT License
from Aidbox
with MIT License
from Aidbox
def create_table(table_name):
return Table(
table_name,
table_metadata,
Column("id", Text, primary_key=True),
Column("txid", BigInteger, nullable=False),
Column("ts", DateTime(True), server_default=text("CURRENT_TIMESTAMP")),
Column("cts", DateTime(True), server_default=text("CURRENT_TIMESTAMP")),
Column("resource_type", Text, server_default=text("'App'::text")),
Column(
"status",
Enum("created", "updated", "deleted", "recreated", name="resource_status"),
nullable=False,
),
Column("resource", _JSONB(astext_type=Text()), nullable=False, index=True),
)
class DBProxy(object):
3
Source : d95efca6f334_add_start_time_to_repository_object.py
with Apache License 2.0
from asharov
with Apache License 2.0
from asharov
def upgrade():
op.add_column('repositories', sa.Column('start_time', sa.DateTime(), nullable=True))
op.add_column('repositories', sa.Column('start_time_utc_offset', sa.Integer(), nullable=True))
def downgrade():
3
Source : fields.py
with BSD 3-Clause "New" or "Revised" License
from awesometoolbox
with BSD 3-Clause "New" or "Revised" License
from awesometoolbox
def DateTime(
*,
primary_key: bool = False,
allow_null: bool = False,
index: bool = False,
unique: bool = False,
) -> Type[datetime]:
namespace = dict(
primary_key=primary_key,
allow_null=allow_null,
index=index,
unique=unique,
column_type=sqlalchemy.DateTime(),
)
return type("DateTime", (datetime, ColumnFactory), namespace)
def Date(
3
Source : 41ac4080a7ed_entity_changes.py
with Apache License 2.0
from bcgov
with Apache License 2.0
from bcgov
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.add_column('entities', sa.Column('last_modified', sa.DateTime(), nullable=True))
op.add_column('entities', sa.Column('last_modified_by', sa.String(), nullable=True))
op.add_column('entities', sa.Column('status', sa.String(), nullable=True))
# ### end Alembic commands ###
def downgrade():
3
Source : fc8b221f938f_added_suspended_date_status.py
with Apache License 2.0
from bcgov
with Apache License 2.0
from bcgov
def upgrade():
# Insert codes and descriptions for organization status
org_status_table = table('org_status',
column('code', String),
column('desc', String),
column('default', Boolean)
)
op.bulk_insert(
org_status_table,
[
{'code': 'NSF_SUSPENDED', 'desc': 'Status for an org which caused Non Sufficient fund for payment.',
'default': False}
]
)
op.add_column('org', sa.Column('suspended_on', sa.DateTime(), nullable=True))
op.add_column('org_version', sa.Column('suspended_on', sa.DateTime(), autoincrement=False, nullable=True))
def downgrade():
3
Source : 700a389cb5e1_create_suspended_table.py
with GNU Affero General Public License v3.0
from betagouv
with GNU Affero General Public License v3.0
from betagouv
def upgrade():
create_table(
"suspended",
Column("id", Integer, primary_key=True),
Column("email", String()),
Column("end_suspension", DateTime()),
)
def downgrade():
3
Source : fbddd9e181d5_create_user.py
with GNU Affero General Public License v3.0
from betagouv
with GNU Affero General Public License v3.0
from betagouv
def upgrade():
create_table("users", Column("email", String(), primary_key=True))
create_table(
"requests",
Column("id", Integer, primary_key=True),
Column("email", String()),
Column("timestamp", DateTime()),
)
def downgrade():
3
Source : d47757e34b68_added_created_field_to_each_model.py
with GNU General Public License v3.0
from bitcartcc
with GNU General Public License v3.0
from bitcartcc
def add_creation_date(table):
op.add_column(
table,
sa.Column(
"created",
sa.DateTime(timezone=True),
nullable=False,
server_default=sa.func.clock_timestamp(), # to differ in context of current transaction
),
)
op.alter_column(table, "created", server_default=None)
def upgrade():
3
Source : model_meta_options.py
with MIT License
from briancappello
with MIT License
from briancappello
def get_column(self, mcs_args: McsArgs):
return sa.Column(sa.DateTime,
server_default=sa_func.now(),
onupdate=sa_func.now(),
nullable=False)
class ReprMetaOption(MetaOption):
3
Source : 20190324_22-05-57__create_base_task_table.py
with MIT License
from busy-beaver-dev
with MIT License
from busy-beaver-dev
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.create_table(
"task",
sa.Column("date_created", sa.DateTime(), nullable=True),
sa.Column("date_modified", sa.DateTime(), nullable=True),
sa.Column("id", sa.String(length=36), nullable=False),
sa.Column("name", sa.String(length=128), nullable=True),
sa.Column("description", sa.String(length=128), nullable=True),
sa.Column("failed", sa.Boolean(), nullable=True),
sa.Column("complete", sa.Boolean(), nullable=True),
sa.PrimaryKeyConstraint("id"),
)
op.create_index(op.f("ix_task_name"), "task", ["name"], unique=False)
# ### end Alembic commands ###
def downgrade():
3
Source : 0193_add_ft_billing_timestamps.py
with MIT License
from cds-snc
with MIT License
from cds-snc
def upgrade():
op.add_column("ft_billing", sa.Column("updated_at", sa.DateTime(), nullable=True))
op.add_column("ft_billing", sa.Column("created_at", sa.DateTime(), nullable=True))
def downgrade():
3
Source : 0195_ft_notification_timestamps.py
with MIT License
from cds-snc
with MIT License
from cds-snc
def upgrade():
op.add_column("ft_notification_status", sa.Column("created_at", sa.DateTime(), nullable=False))
op.add_column("ft_notification_status", sa.Column("updated_at", sa.DateTime(), nullable=True))
def downgrade():
3
Source : 0288_add_go_live_user.py
with MIT License
from cds-snc
with MIT License
from cds-snc
def upgrade():
op.add_column("services", sa.Column("go_live_at", sa.DateTime(), nullable=True))
op.add_column(
"services",
sa.Column("go_live_user_id", postgresql.UUID(as_uuid=True), nullable=True),
)
op.create_foreign_key("fk_services_go_live_user", "services", "users", ["go_live_user_id"], ["id"])
op.add_column("services_history", sa.Column("go_live_at", sa.DateTime(), nullable=True))
op.add_column(
"services_history",
sa.Column("go_live_user_id", postgresql.UUID(as_uuid=True), nullable=True),
)
def downgrade():
3
Source : 027_imapuid_soft_deletes.py
with GNU Affero General Public License v3.0
from closeio
with GNU Affero General Public License v3.0
from closeio
def upgrade():
t = table("imapuid", column("deleted_at", sa.DateTime()))
op.execute(t.delete().where(t.c.deleted_at.is_(None)))
def downgrade():
3
Source : 183_change_event_sync_timestamp.py
with GNU Affero General Public License v3.0
from closeio
with GNU Affero General Public License v3.0
from closeio
def upgrade():
op.add_column("calendar", sa.Column("last_synced", sa.DateTime(), nullable=True))
conn = op.get_bind()
conn.execute(
"""UPDATE calendar
JOIN namespace ON calendar.namespace_id=namespace.id
JOIN account ON namespace.account_id=account.id
JOIN gmailaccount ON account.id=gmailaccount.id
SET calendar.last_synced=account.last_synced_events
WHERE account.emailed_events_calendar_id != calendar.id"""
)
def downgrade():
3
Source : 189_add_initial_sync_start_end_column.py
with GNU Affero General Public License v3.0
from closeio
with GNU Affero General Public License v3.0
from closeio
def upgrade():
op.add_column("folder", sa.Column("initial_sync_end", sa.DateTime(), nullable=True))
op.add_column(
"folder", sa.Column("initial_sync_start", sa.DateTime(), nullable=True)
)
def downgrade():
3
Source : 191_add_new_events_and_calendars_flags.py
with GNU Affero General Public License v3.0
from closeio
with GNU Affero General Public License v3.0
from closeio
def upgrade():
op.add_column("gmailaccount", sa.Column("last_calendar_list_sync", sa.DateTime()))
op.add_column(
"gmailaccount", sa.Column("gpush_calendar_list_last_ping", sa.DateTime())
)
op.add_column(
"gmailaccount", sa.Column("gpush_calendar_list_expiration", sa.DateTime())
)
op.add_column("calendar", sa.Column("gpush_last_ping", sa.DateTime()))
op.add_column("calendar", sa.Column("gpush_expiration", sa.DateTime()))
def downgrade():
3
Source : 198_eas_foldersyncstatus_startstop_columns.py
with GNU Affero General Public License v3.0
from closeio
with GNU Affero General Public License v3.0
from closeio
def upgrade():
from inbox.ignition import main_engine
engine = main_engine(pool_size=1, max_overflow=0)
if not engine.has_table("easfoldersyncstatus"):
return
op.add_column(
"easfoldersyncstatus",
sa.Column("initial_sync_end", sa.DateTime(), nullable=True),
)
op.add_column(
"easfoldersyncstatus",
sa.Column("initial_sync_start", sa.DateTime(), nullable=True),
)
def downgrade():
3
Source : 200_update_imapfolderinfo.py
with GNU Affero General Public License v3.0
from closeio
with GNU Affero General Public License v3.0
from closeio
def upgrade():
op.add_column(
"imapfolderinfo", sa.Column("last_slow_refresh", sa.DateTime(), nullable=True)
)
def downgrade():
3
Source : 232_add_thread_deleted_at.py
with GNU Affero General Public License v3.0
from closeio
with GNU Affero General Public License v3.0
from closeio
def upgrade():
op.add_column("thread", sa.Column("deleted_at", sa.DateTime(), nullable=True))
op.create_index(
"ix_thread_namespace_id_deleted_at",
"thread",
["namespace_id", "deleted_at"],
unique=False,
)
def downgrade():
3
Source : 0c5070e96b57_add_user_attributes_table.py
with Apache License 2.0
from CloudmindsRobot
with Apache License 2.0
from CloudmindsRobot
def upgrade():
op.create_table(
"user_attribute",
sa.Column("created_on", sa.DateTime(), nullable=True),
sa.Column("changed_on", sa.DateTime(), nullable=True),
sa.Column("id", sa.Integer(), nullable=False),
sa.Column("user_id", sa.Integer(), nullable=True),
sa.Column("welcome_dashboard_id", sa.Integer(), nullable=True),
sa.Column("created_by_fk", sa.Integer(), nullable=True),
sa.Column("changed_by_fk", sa.Integer(), nullable=True),
sa.ForeignKeyConstraint(["changed_by_fk"], ["ab_user.id"]),
sa.ForeignKeyConstraint(["created_by_fk"], ["ab_user.id"]),
sa.ForeignKeyConstraint(["user_id"], ["ab_user.id"]),
sa.ForeignKeyConstraint(["welcome_dashboard_id"], ["dashboards.id"]),
sa.PrimaryKeyConstraint("id"),
)
def downgrade():
3
Source : 5e4a03ef0bf0_add_request_access_model.py
with Apache License 2.0
from CloudmindsRobot
with Apache License 2.0
from CloudmindsRobot
def upgrade():
op.create_table(
"access_request",
sa.Column("created_on", sa.DateTime(), nullable=True),
sa.Column("changed_on", sa.DateTime(), nullable=True),
sa.Column("id", sa.Integer(), nullable=False),
sa.Column("datasource_type", sa.String(length=200), nullable=True),
sa.Column("datasource_id", sa.Integer(), nullable=True),
sa.Column("changed_by_fk", sa.Integer(), nullable=True),
sa.Column("created_by_fk", sa.Integer(), nullable=True),
sa.ForeignKeyConstraint(["changed_by_fk"], ["ab_user.id"]),
sa.ForeignKeyConstraint(["created_by_fk"], ["ab_user.id"]),
sa.PrimaryKeyConstraint("id"),
)
def downgrade():
3
Source : 8e80a26a31db_.py
with Apache License 2.0
from CloudmindsRobot
with Apache License 2.0
from CloudmindsRobot
def upgrade():
op.create_table(
"url",
sa.Column("created_on", sa.DateTime(), nullable=False),
sa.Column("changed_on", sa.DateTime(), nullable=False),
sa.Column("id", sa.Integer(), nullable=False),
sa.Column("url", sa.Text(), nullable=True),
sa.Column("created_by_fk", sa.Integer(), nullable=True),
sa.Column("changed_by_fk", sa.Integer(), nullable=True),
sa.ForeignKeyConstraint(["changed_by_fk"], ["ab_user.id"]),
sa.ForeignKeyConstraint(["created_by_fk"], ["ab_user.id"]),
sa.PrimaryKeyConstraint("id"),
)
def downgrade():
3
Source : d827694c7555_css_templates.py
with Apache License 2.0
from CloudmindsRobot
with Apache License 2.0
from CloudmindsRobot
def upgrade():
op.create_table(
"css_templates",
sa.Column("created_on", sa.DateTime(), nullable=False),
sa.Column("changed_on", sa.DateTime(), nullable=False),
sa.Column("id", sa.Integer(), nullable=False),
sa.Column("template_name", sa.String(length=250), nullable=True),
sa.Column("css", sa.Text(), nullable=True),
sa.Column("changed_by_fk", sa.Integer(), nullable=True),
sa.Column("created_by_fk", sa.Integer(), nullable=True),
sa.ForeignKeyConstraint(["changed_by_fk"], ["ab_user.id"]),
sa.ForeignKeyConstraint(["created_by_fk"], ["ab_user.id"]),
sa.PrimaryKeyConstraint("id"),
)
def downgrade():
3
Source : model_fields.py
with MIT License
from collerek
with MIT License
from collerek
def get_column_type(cls, **kwargs: Any) -> Any:
"""
Return proper type of db column for given field type.
Accepts required and optional parameters that each column type accepts.
:param kwargs: key, value pairs of sqlalchemy options
:type kwargs: Any
:return: initialized column with proper options
:rtype: sqlalchemy Column
"""
return sqlalchemy.DateTime(timezone=kwargs.get("timezone", False))
class Date(ModelFieldFactory, datetime.date):
3
Source : 976b7ef3ec86_add_created_field.py
with GNU General Public License v3.0
from containerbuildsystem
with GNU General Public License v3.0
from containerbuildsystem
def upgrade():
with op.batch_alter_table("request", schema=None) as batch_op:
batch_op.add_column(sa.Column("created", sa.DateTime(), nullable=True))
batch_op.create_index(batch_op.f("ix_request_created"), ["created"], unique=False)
def downgrade():
3
Source : 0ab2d6bca67d_.py
with Apache License 2.0
from deep-learning-indaba
with Apache License 2.0
from deep-learning-indaba
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.add_column('app_user', sa.Column(
'user_dateOfBirth', sa.DateTime(), nullable=True))
op.add_column('app_user', sa.Column('user_primaryLanguage',
sa.String(length=255), nullable=True))
# ### end Alembic commands ###
def downgrade():
3
Source : 72548fc390d4_.py
with Apache License 2.0
from deep-learning-indaba
with Apache License 2.0
from deep-learning-indaba
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.add_column('app_user', sa.Column('policy_agreed_datetime', sa.DateTime(), nullable=True))
# ### end Alembic commands ###
def downgrade():
3
Source : eac3fd9d5ae8_.py
with Apache License 2.0
from deep-learning-indaba
with Apache License 2.0
from deep-learning-indaba
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.alter_column('guest_registration', 'confirmation_email_sent_at',
existing_type=postgresql.TIMESTAMP(),
nullable=True)
op.alter_column('guest_registration', 'created_at',
existing_type=postgresql.TIMESTAMP(),
nullable=True)
op.drop_column('invitation_letter_request', 'invitation_letter_sent_at')
op.add_column('invitation_letter_request', sa.Column('invitation_letter_sent_at', sa.DateTime(), nullable=False))
# ### end Alembic commands ###
def downgrade():
3
Source : f349debf9e15_.py
with Apache License 2.0
from deep-learning-indaba
with Apache License 2.0
from deep-learning-indaba
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.add_column('invitation_letter_request', sa.Column('passport_expiry_date', sa.DateTime(), nullable=False))
# ### end Alembic commands ###
def downgrade():
3
Source : da858bf1a1b3_added_scrape_and_parse_timestamps_to_.py
with GNU General Public License v3.0
from dismantl
with GNU General Public License v3.0
from dismantl
def upgrade():
op.add_column('cases', sa.Column('last_scrape', sa.DateTime))
op.add_column('cases', sa.Column('last_parse', sa.DateTime))
def downgrade():
3
Source : 2020-07-28_2b8448aa451e_timestamps_and_random_password.py
with MIT License
from dpuljic01
with MIT License
from dpuljic01
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.add_column("portfolio", sa.Column("created_at", sa.DateTime(), nullable=False))
op.add_column("portfolio", sa.Column("updated_at", sa.DateTime(), nullable=False))
op.add_column("stocks", sa.Column("created_at", sa.DateTime(), nullable=False))
op.add_column("stocks", sa.Column("updated_at", sa.DateTime(), nullable=False))
op.alter_column(
"users", "password", existing_type=postgresql.BYTEA(), nullable=True
)
op.add_column("users", sa.Column("last_logged_in", sa.DateTime(), nullable=True))
op.add_column("portfolio", sa.Column("info", sa.Text(), nullable=True))
# ### end Alembic commands ###
def downgrade():
3
Source : 2020-08-07_a3f836d85d38_add_holdings_table.py
with MIT License
from dpuljic01
with MIT License
from dpuljic01
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.create_table(
"holdings",
sa.Column("created_at", sa.DateTime(), nullable=False),
sa.Column("updated_at", sa.DateTime(), nullable=False),
sa.Column("id", sa.Integer(), nullable=False),
sa.Column("portfolio_id", sa.Integer(), nullable=False),
sa.Column("stock_id", sa.Integer(), nullable=False),
sa.Column("price", sa.Numeric(), nullable=False),
sa.Column("purchased_at", sa.DateTime(), nullable=False),
sa.ForeignKeyConstraint(["portfolio_id"], ["portfolio.id"], ondelete="CASCADE"),
sa.ForeignKeyConstraint(["stock_id"], ["stocks.id"], ondelete="CASCADE"),
sa.PrimaryKeyConstraint("id"),
)
# ### end Alembic commands ###
def downgrade():
3
Source : 016_feb771f719c7_remove_usersiterankings_competition_fk_.py
with GNU General Public License v3.0
from euphwes
with GNU General Public License v3.0
from euphwes
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
with op.batch_alter_table('user_site_rankings', schema=None) as batch_op:
batch_op.add_column(sa.Column('timestamp', sa.DateTime(), nullable=True))
batch_op.drop_constraint('user_site_rankings_comp_id_fkey', type_='foreignkey')
batch_op.drop_column('comp_id')
# ### end Alembic commands ###
def downgrade():
3
Source : 4446e08588_dagrun_start_end.py
with Apache License 2.0
from flink-extended
with Apache License 2.0
from flink-extended
def upgrade(): # noqa: D103
op.add_column('dag_run', sa.Column('end_date', sa.DateTime(), nullable=True))
op.add_column('dag_run', sa.Column('start_date', sa.DateTime(), nullable=True))
def downgrade(): # noqa: D103
3
Source : test_dialect.py
with Apache License 2.0
from gethue
with Apache License 2.0
from gethue
def test_date_reflection(self):
metadata = self.metadata
Table(
"pgdate",
metadata,
Column("date1", DateTime(timezone=True)),
Column("date2", DateTime(timezone=False)),
)
metadata.create_all()
m2 = MetaData(testing.db)
t2 = Table("pgdate", m2, autoload=True)
assert t2.c.date1.type.timezone is True
assert t2.c.date2.type.timezone is False
@testing.requires.psycopg2_compatibility
3
Source : test_query.py
with Apache License 2.0
from gethue
with Apache License 2.0
from gethue
def define_tables(cls, metadata):
Table(
"t",
metadata,
Column("id", Integer, primary_key=True),
Column("dtme", DateTime),
Column("dt", Date),
Column("tm", Time),
Column("intv", postgresql.INTERVAL),
Column("dttz", DateTime(timezone=True)),
)
@classmethod
3
Source : a8899f1b2311_create_start_conditions.py
with Apache License 2.0
from google
with Apache License 2.0
from google
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.create_table('start_conditions',
sa.Column('created_at', sa.DateTime(), nullable=False),
sa.Column('updated_at', sa.DateTime(), nullable=False),
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('job_id', sa.Integer(), nullable=True),
sa.Column('condition', sa.String(length=255), nullable=True),
sa.ForeignKeyConstraint(['job_id'], ['jobs.id'], ),
sa.PrimaryKeyConstraint('id')
)
# ### end Alembic commands ###
def downgrade():
3
Source : cd6376dcdf27_create_jobs.py
with Apache License 2.0
from google
with Apache License 2.0
from google
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.create_table('jobs',
sa.Column('created_at', sa.DateTime(), nullable=False),
sa.Column('updated_at', sa.DateTime(), nullable=False),
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('name', sa.String(length=255), nullable=True),
sa.Column('worker_class', sa.String(length=255), nullable=True),
sa.Column('status', sa.String(length=50), nullable=False),
sa.Column('status_changed_at', sa.DateTime(), nullable=True),
sa.Column('pipeline_id', sa.Integer(), nullable=True),
sa.ForeignKeyConstraint(['pipeline_id'], ['pipelines.id'], ),
sa.PrimaryKeyConstraint('id')
)
# ### end Alembic commands ###
def downgrade():
3
Source : 8f8e3c12623c_.py
with GNU General Public License v3.0
from hashview
with GNU General Public License v3.0
from hashview
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.add_column('jobs', sa.Column('created_at', sa.DateTime(), nullable=False))
op.drop_column('jobs', 'created')
# ### end Alembic commands ###
def downgrade():
3
Source : d858c1c61437_.py
with GNU General Public License v3.0
from hashview
with GNU General Public License v3.0
from hashview
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.add_column('agents', sa.Column('last_checkin', sa.DateTime(), nullable=True))
op.drop_column('agents', 'last_checkn')
# ### end Alembic commands ###
def downgrade():
3
Source : 5645ff0023eb_update_task_fractional_seconds_for_last_.py
with Apache License 2.0
from IndustryEssentials
with Apache License 2.0
from IndustryEssentials
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
if context.get_x_argument(as_dictionary=True).get("sqlite", None):
with op.batch_alter_table("task") as batch_op:
batch_op.alter_column(
"last_message_datetime",
existing_type=DATETIME(fsp=6),
type_=sa.DateTime(),
existing_nullable=True,
)
else:
op.alter_column(
"task",
"last_message_datetime",
existing_type=DATETIME(fsp=6),
type_=sa.DateTime(),
existing_nullable=True,
)
# ### end Alembic commands ###
3
Source : 262155567f30_añade_campo_created_a_post.py
with Apache License 2.0
from j2logo
with Apache License 2.0
from j2logo
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.add_column('post', sa.Column('created', sa.DateTime(), nullable=True))
# ### end Alembic commands ###
def downgrade():
3
Source : d95c7fb0f421_.py
with MIT License
from jonra1993
with MIT License
from jonra1993
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.add_column('song', sa.Column('updated_at', sa.DateTime(), nullable=True))
op.add_column('song', sa.Column('created_at', sa.DateTime(), nullable=True))
# ### end Alembic commands ###
def downgrade():
3
Source : 1cf31ab18f84_create_secret_table.py
with Apache License 2.0
from Kraken-CI
with Apache License 2.0
from Kraken-CI
def upgrade():
op.create_table('secrets',
sa.Column('created', sa.DateTime(), nullable=False),
sa.Column('updated', sa.DateTime(), nullable=False),
sa.Column('deleted', sa.DateTime(), nullable=True),
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('name', sa.Unicode(length=255), nullable=True),
sa.Column('project_id', sa.Integer(), nullable=False),
sa.Column('kind', sa.Integer(), nullable=True),
sa.Column('data', postgresql.JSONB(astext_type=sa.Text()), nullable=True),
sa.ForeignKeyConstraint(['project_id'], ['projects.id'], ),
sa.PrimaryKeyConstraint('id'))
def downgrade():
3
Source : a35aec7afa0a_added_processed_at_in_run_and_index_to_.py
with Apache License 2.0
from Kraken-CI
with Apache License 2.0
from Kraken-CI
def upgrade():
op.add_column('runs', sa.Column('processed_at', sa.DateTime(timezone=True), nullable=True))
op.create_index('ix_test_case_results_test_case_id', 'test_case_results', ['test_case_id'], unique=False)
def downgrade():
3
Source : 8b560fcec5f7_add_games_deleted_at_column_for_soft_.py
with MIT License
from lexicalunit
with MIT License
from lexicalunit
def upgrade():
op.add_column("games", sa.Column("deleted_at", sa.DateTime(), nullable=True))
op.create_index(op.f("ix_games_deleted_at"), "games", ["deleted_at"], unique=False)
def downgrade():
3
Source : 0856e735a1a4_.py
with Mozilla Public License 2.0
from MCArchive
with Mozilla Public License 2.0
from MCArchive
def upgrade():
op.add_column('draft_mod', sa.Column('time_changed', sa.DateTime(timezone=True), nullable=True))
op.add_column('draft_mod', sa.Column('time_created', sa.DateTime(timezone=True), server_default=sa.text('CURRENT_TIMESTAMP'), nullable=False))
op.add_column('log_mod', sa.Column('time_changed', sa.DateTime(timezone=True), nullable=True))
op.add_column('log_mod', sa.Column('time_created', sa.DateTime(timezone=True), server_default=sa.text('CURRENT_TIMESTAMP'), nullable=False))
op.add_column('mod', sa.Column('time_changed', sa.DateTime(timezone=True), nullable=True))
op.add_column('mod', sa.Column('time_created', sa.DateTime(timezone=True), server_default=sa.text('CURRENT_TIMESTAMP'), nullable=False))
def downgrade():
3
Source : adbaf888ae31_.py
with Mozilla Public License 2.0
from MCArchive
with Mozilla Public License 2.0
from MCArchive
def upgrade():
op.add_column('draft_mod', sa.Column('archived_time', sa.DateTime(timezone=True), nullable=True))
op.add_column('draft_mod', sa.Column('merged_time', sa.DateTime(timezone=True), nullable=True))
op.execute("UPDATE draft_mod "
"SET archived_time = (now() at time zone 'utc'), "
"merged_time = (now() at time zone 'utc') "
"WHERE archived = true ")
op.execute("UPDATE draft_mod "
"SET archived_time = null, "
"merged_time = null "
"WHERE archived = false ")
op.drop_column('draft_mod', 'archived')
def downgrade():
3
Source : 019da77ba02d_.py
with GNU Affero General Public License v3.0
from minetest
with GNU Affero General Public License v3.0
from minetest
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.add_column('package_review', sa.Column('created_at', sa.DateTime(), nullable=False, server_default=datetime.datetime.utcnow().isoformat()))
# ### end Alembic commands ###
def downgrade():
See More Examples