Skip to content

Commit c728594

Browse files
authored
Merge pull request #164 from mekanix/migrate
Make migrate script
2 parents 0a0c1a8 + 2c22559 commit c728594

File tree

6 files changed

+36
-4
lines changed

6 files changed

+36
-4
lines changed

alembic.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ prepend_sys_path = .
3939
# are written from script.py.mako
4040
# output_encoding = utf-8
4141

42-
sqlalchemy.url = sqlite:///db.sqlite
42+
#sqlalchemy.url = sqlite:///db.sqlite
4343

4444

4545
[post_write_hooks]

bin/common.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,6 @@ setup() {
3232
mkdir alembic/versions
3333
alembic revision --autogenerate -m initial
3434
fi
35-
alembic upgrade head
35+
python migrate.py
3636
fi
3737
}

freenit/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = "0.3.10"
1+
__version__ = "0.3.11"

freenit/project/alembic.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ prepend_sys_path = .
3939
# are written from script.py.mako
4040
# output_encoding = utf-8
4141

42-
sqlalchemy.url = sqlite:///db.sqlite
42+
#sqlalchemy.url = sqlite:///db.sqlite
4343

4444

4545
[post_write_hooks]

freenit/project/migrate.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import importlib
2+
3+
from alembic import command
4+
from alembic.config import Config
5+
from name import app_name
6+
7+
alembic_cfg = Config("alembic.ini")
8+
9+
10+
def db_setup():
11+
importlib.import_module(f"{app_name}.app")
12+
command.upgrade(alembic_cfg, "head")
13+
14+
15+
if __name__ == "__main__":
16+
db_setup()

migrate.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import importlib
2+
3+
from alembic import command
4+
from alembic.config import Config
5+
from name import app_name
6+
7+
alembic_cfg = Config("alembic.ini")
8+
9+
10+
def db_setup():
11+
importlib.import_module(f"{app_name}.app")
12+
command.upgrade(alembic_cfg, "head")
13+
14+
15+
if __name__ == "__main__":
16+
db_setup()

0 commit comments

Comments
 (0)