MikroWizard Initial commit | MikroMan Welcome to the world :)

This commit is contained in:
sepehr 2024-07-20 15:48:46 +03:30
commit 8c49b9a55d
96 changed files with 12274 additions and 0 deletions

View file

@ -0,0 +1,23 @@
# 001_init.py
def migrate(migrator, database, fake=False, **kwargs):
"""Write your migrations here."""
migrator.sql("""CREATE TABLE users (
id INTEGER PRIMARY KEY,
created timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
modified timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
email text UNIQUE,
password text,
first_name text,
last_name text,
role text DEFAULT 'readonly',
tags text
)""")
def rollback(migrator, database, fake=False, **kwargs):
"""Write your rollback migrations here."""

View file

@ -0,0 +1,20 @@
# 002_movies.py
def migrate(migrator, database, fake=False, **kwargs):
migrator.sql("""CREATE TABLE movies(
id INTEGER PRIMARY KEY,
created timestamp not null default CURRENT_TIMESTAMP,
modified timestamp not null default CURRENT_TIMESTAMP,
creator integer REFERENCES users(id),
title text,
director text
)""")
def rollback(migrator, database, fake=False, **kwargs):
migrator.sql("""DROP TABLE movies""")