kanha-upadhyay commited on
Commit
dd2919b
·
1 Parent(s): fa7375e

refactor: remove obsolete migration files and update initialization migration

Browse files
migrations/versions/3292a4761b48_files_and_vector_records.py DELETED
@@ -1,48 +0,0 @@
1
- """files_and_vector_records
2
-
3
- Revision ID: 3292a4761b48
4
- Revises: 8652e8501339
5
- Create Date: 2024-10-28 13:03:53.442309
6
-
7
- """
8
- from typing import Sequence, Union
9
-
10
- from alembic import op
11
- import sqlalchemy as sa
12
-
13
-
14
- # revision identifiers, used by Alembic.
15
- revision: str = '3292a4761b48'
16
- down_revision: Union[str, None] = '8652e8501339'
17
- branch_labels: Union[str, Sequence[str], None] = None
18
- depends_on: Union[str, Sequence[str], None] = None
19
-
20
-
21
- def upgrade() -> None:
22
- # ### commands auto generated by Alembic - please adjust! ###
23
- op.create_table('files',
24
- sa.Column('id', sa.Integer(), autoincrement=True, nullable=False),
25
- sa.Column('file_name', sa.String(), nullable=False),
26
- sa.Column('uploaded_at', sa.DateTime(), nullable=False),
27
- sa.Column('processed_at', sa.DateTime(), nullable=True),
28
- sa.Column('slack_file_id', sa.String(), nullable=True),
29
- sa.Column('user_id', sa.Integer(), nullable=False),
30
- sa.Column('mime_type', sa.String(), nullable=False),
31
- sa.ForeignKeyConstraint(['user_id'], ['users.id'], ),
32
- sa.PrimaryKeyConstraint('id')
33
- )
34
- op.create_table('vector_records',
35
- sa.Column('id', sa.Integer(), autoincrement=True, nullable=False),
36
- sa.Column('file_id', sa.Integer(), nullable=False),
37
- sa.Column('record_id', sa.Integer(), nullable=False),
38
- sa.ForeignKeyConstraint(['file_id'], ['files.id'], ),
39
- sa.PrimaryKeyConstraint('id')
40
- )
41
- # ### end Alembic commands ###
42
-
43
-
44
- def downgrade() -> None:
45
- # ### commands auto generated by Alembic - please adjust! ###
46
- op.drop_table('vector_records')
47
- op.drop_table('files')
48
- # ### end Alembic commands ###
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
migrations/versions/653e10175e07_record_id_column.py DELETED
@@ -1,36 +0,0 @@
1
- """record id column
2
-
3
- Revision ID: 653e10175e07
4
- Revises: 96747434d72b
5
- Create Date: 2024-11-04 23:26:52.258704
6
-
7
- """
8
- from typing import Sequence, Union
9
-
10
- from alembic import op
11
- import sqlalchemy as sa
12
-
13
-
14
- # revision identifiers, used by Alembic.
15
- revision: str = '653e10175e07'
16
- down_revision: Union[str, None] = '96747434d72b'
17
- branch_labels: Union[str, Sequence[str], None] = None
18
- depends_on: Union[str, Sequence[str], None] = None
19
-
20
-
21
- def upgrade() -> None:
22
- # ### commands auto generated by Alembic - please adjust! ###
23
- op.alter_column('vector_records', 'record_id',
24
- existing_type=sa.INTEGER(),
25
- type_=sa.String(),
26
- existing_nullable=False)
27
- # ### end Alembic commands ###
28
-
29
-
30
- def downgrade() -> None:
31
- # ### commands auto generated by Alembic - please adjust! ###
32
- op.alter_column('vector_records', 'record_id',
33
- existing_type=sa.String(),
34
- type_=sa.INTEGER(),
35
- existing_nullable=False)
36
- # ### end Alembic commands ###
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
migrations/versions/{8652e8501339_add_user_and_slack_team.py → 6f82114b956f_initialisation.py} RENAMED
@@ -1,8 +1,8 @@
1
- """add user and slack team
2
 
3
- Revision ID: 8652e8501339
4
  Revises:
5
- Create Date: 2024-10-24 16:52:59.936776
6
 
7
  """
8
  from typing import Sequence, Union
@@ -12,7 +12,7 @@ import sqlalchemy as sa
12
 
13
 
14
  # revision identifiers, used by Alembic.
15
- revision: str = '8652e8501339'
16
  down_revision: Union[str, None] = None
17
  branch_labels: Union[str, Sequence[str], None] = None
18
  depends_on: Union[str, Sequence[str], None] = None
@@ -36,15 +36,45 @@ def upgrade() -> None:
36
  sa.Column('slack_team_id', sa.Integer(), nullable=True),
37
  sa.Column('email_id', sa.String(), nullable=False),
38
  sa.Column('last_message_sent_at', sa.DateTime(), nullable=True),
 
39
  sa.Column('created_at', sa.DateTime(), nullable=False),
40
  sa.ForeignKeyConstraint(['slack_team_id'], ['slack_teams.id'], ),
41
  sa.PrimaryKeyConstraint('id')
42
  )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
43
  # ### end Alembic commands ###
44
 
45
 
46
  def downgrade() -> None:
47
  # ### commands auto generated by Alembic - please adjust! ###
 
 
 
48
  op.drop_table('users')
49
  op.drop_table('slack_teams')
50
  # ### end Alembic commands ###
 
1
+ """Initialisation
2
 
3
+ Revision ID: 6f82114b956f
4
  Revises:
5
+ Create Date: 2024-11-07 14:04:41.141506
6
 
7
  """
8
  from typing import Sequence, Union
 
12
 
13
 
14
  # revision identifiers, used by Alembic.
15
+ revision: str = '6f82114b956f'
16
  down_revision: Union[str, None] = None
17
  branch_labels: Union[str, Sequence[str], None] = None
18
  depends_on: Union[str, Sequence[str], None] = None
 
36
  sa.Column('slack_team_id', sa.Integer(), nullable=True),
37
  sa.Column('email_id', sa.String(), nullable=False),
38
  sa.Column('last_message_sent_at', sa.DateTime(), nullable=True),
39
+ sa.Column('next_content_delivery_date', sa.DateTime(), nullable=True),
40
  sa.Column('created_at', sa.DateTime(), nullable=False),
41
  sa.ForeignKeyConstraint(['slack_team_id'], ['slack_teams.id'], ),
42
  sa.PrimaryKeyConstraint('id')
43
  )
44
+ op.create_table('files',
45
+ sa.Column('id', sa.Integer(), autoincrement=True, nullable=False),
46
+ sa.Column('file_name', sa.String(), nullable=False),
47
+ sa.Column('uploaded_at', sa.DateTime(), nullable=False),
48
+ sa.Column('processed_at', sa.DateTime(), nullable=True),
49
+ sa.Column('slack_file_id', sa.String(), nullable=True),
50
+ sa.Column('user_id', sa.Integer(), nullable=False),
51
+ sa.Column('mime_type', sa.String(), nullable=False),
52
+ sa.ForeignKeyConstraint(['user_id'], ['users.id'], ),
53
+ sa.PrimaryKeyConstraint('id')
54
+ )
55
+ op.create_table('personalized_content',
56
+ sa.Column('id', sa.Integer(), autoincrement=True, nullable=False),
57
+ sa.Column('content', sa.Text(), nullable=False),
58
+ sa.Column('user_id', sa.Integer(), nullable=False),
59
+ sa.Column('delivered_at', sa.DateTime(), nullable=True),
60
+ sa.ForeignKeyConstraint(['user_id'], ['users.id'], ),
61
+ sa.PrimaryKeyConstraint('id')
62
+ )
63
+ op.create_table('vector_records',
64
+ sa.Column('id', sa.Integer(), autoincrement=True, nullable=False),
65
+ sa.Column('file_id', sa.Integer(), nullable=False),
66
+ sa.Column('record_id', sa.String(), nullable=False),
67
+ sa.ForeignKeyConstraint(['file_id'], ['files.id'], ),
68
+ sa.PrimaryKeyConstraint('id')
69
+ )
70
  # ### end Alembic commands ###
71
 
72
 
73
  def downgrade() -> None:
74
  # ### commands auto generated by Alembic - please adjust! ###
75
+ op.drop_table('vector_records')
76
+ op.drop_table('personalized_content')
77
+ op.drop_table('files')
78
  op.drop_table('users')
79
  op.drop_table('slack_teams')
80
  # ### end Alembic commands ###
migrations/versions/96747434d72b_next_delivery_date_and_personalised_.py DELETED
@@ -1,40 +0,0 @@
1
- """next_delivery_date and personalised column
2
-
3
- Revision ID: 96747434d72b
4
- Revises: 3292a4761b48
5
- Create Date: 2024-10-30 10:58:35.523977
6
-
7
- """
8
-
9
- from typing import Sequence, Union
10
-
11
- from alembic import op
12
- import sqlalchemy as sa
13
-
14
-
15
- # revision identifiers, used by Alembic.
16
- revision: str = '96747434d72b'
17
- down_revision: Union[str, None] = "3292a4761b48"
18
- branch_labels: Union[str, Sequence[str], None] = None
19
- depends_on: Union[str, Sequence[str], None] = None
20
-
21
-
22
- def upgrade() -> None:
23
- # ### commands auto generated by Alembic - please adjust! ###
24
- op.create_table('personalized_content',
25
- sa.Column('id', sa.Integer(), autoincrement=True, nullable=False),
26
- sa.Column('content', sa.Text(), nullable=False),
27
- sa.Column('user_id', sa.Integer(), nullable=False),
28
- sa.Column('delivered_at', sa.DateTime(), nullable=True),
29
- sa.ForeignKeyConstraint(['user_id'], ['users.id'], ),
30
- sa.PrimaryKeyConstraint('id')
31
- )
32
- op.add_column('users', sa.Column('next_content_delivery_date', sa.DateTime(), nullable=True))
33
- # ### end Alembic commands ###
34
-
35
-
36
- def downgrade() -> None:
37
- # ### commands auto generated by Alembic - please adjust! ###
38
- op.drop_column('users', 'next_content_delivery_date')
39
- op.drop_table('personalized_content')
40
- # ### end Alembic commands ###
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
poetry.lock CHANGED
@@ -120,6 +120,24 @@ files = [
120
  [package.dependencies]
121
  frozenlist = ">=1.1.0"
122
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
123
  [[package]]
124
  name = "alembic"
125
  version = "1.14.0"
@@ -3332,4 +3350,4 @@ propcache = ">=0.2.0"
3332
  [metadata]
3333
  lock-version = "2.0"
3334
  python-versions = "3.12.*"
3335
- content-hash = "5930615910191cc57c6919c9904b481049afd96fe5daf163ce6ed3569cc60b25"
 
120
  [package.dependencies]
121
  frozenlist = ">=1.1.0"
122
 
123
+ [[package]]
124
+ name = "aiosqlite"
125
+ version = "0.20.0"
126
+ description = "asyncio bridge to the standard sqlite3 module"
127
+ optional = false
128
+ python-versions = ">=3.8"
129
+ files = [
130
+ {file = "aiosqlite-0.20.0-py3-none-any.whl", hash = "sha256:36a1deaca0cac40ebe32aac9977a6e2bbc7f5189f23f4a54d5908986729e5bd6"},
131
+ {file = "aiosqlite-0.20.0.tar.gz", hash = "sha256:6d35c8c256637f4672f843c31021464090805bf925385ac39473fb16eaaca3d7"},
132
+ ]
133
+
134
+ [package.dependencies]
135
+ typing_extensions = ">=4.0"
136
+
137
+ [package.extras]
138
+ dev = ["attribution (==1.7.0)", "black (==24.2.0)", "coverage[toml] (==7.4.1)", "flake8 (==7.0.0)", "flake8-bugbear (==24.2.6)", "flit (==3.9.0)", "mypy (==1.8.0)", "ufmt (==2.3.0)", "usort (==1.0.8.post1)"]
139
+ docs = ["sphinx (==7.2.6)", "sphinx-mdinclude (==0.5.3)"]
140
+
141
  [[package]]
142
  name = "alembic"
143
  version = "1.14.0"
 
3350
  [metadata]
3351
  lock-version = "2.0"
3352
  python-versions = "3.12.*"
3353
+ content-hash = "628d29d4f3ed77432eff709cd821db42cc00c75c03ee84a30e120ea6014e2252"
pyproject.toml CHANGED
@@ -28,6 +28,7 @@ pinecone = "^5.3.1"
28
  langchain-pinecone = "^0.2.0"
29
  langchain-core = "^0.3.12"
30
  sqlalchemy = "^2.0.36"
 
31
 
32
  [tool.poetry.group.dev.dependencies]
33
  pytest-env = "^1.1.5"
 
28
  langchain-pinecone = "^0.2.0"
29
  langchain-core = "^0.3.12"
30
  sqlalchemy = "^2.0.36"
31
+ aiosqlite = "^0.20.0"
32
 
33
  [tool.poetry.group.dev.dependencies]
34
  pytest-env = "^1.1.5"