-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adverb statistics -- ispras/lingvodoc-react#1128 (#1509)
* all_changes * cleanup * fixes for delete
- Loading branch information
Showing
6 changed files
with
3,392 additions
and
1,667 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
"""add_hash_adverb | ||
Revision ID: 483f9330348c | ||
Revises: 9a82fe69ceee | ||
Create Date: 2023-04-03 17:07:49.155801 | ||
""" | ||
|
||
# revision identifiers, used by Alembic. | ||
revision = '483f9330348c' | ||
down_revision = '9a82fe69ceee' | ||
branch_labels = None | ||
depends_on = None | ||
|
||
from alembic import op | ||
import sqlalchemy as sa | ||
|
||
|
||
def upgrade(): | ||
op.execute(''' | ||
ALTER TABLE valency_parser_data | ||
ADD hash_adverb TEXT; | ||
UPDATE valency_parser_data | ||
SET hash_adverb = '' | ||
WHERE hash_adverb IS NULL; | ||
ALTER TABLE valency_parser_data | ||
ALTER COLUMN hash_adverb SET NOT NULL; | ||
''') | ||
|
||
def downgrade(): | ||
op.execute(''' | ||
ALTER TABLE valency_parser_data | ||
DROP COLUMN hash_adverb; | ||
''') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
"""Adverb data | ||
Revision ID: 9a82fe69ceee | ||
Revises: be06149acd44 | ||
Create Date: 2023-03-22 21:47:10.366535 | ||
""" | ||
|
||
# revision identifiers, used by Alembic. | ||
revision = '9a82fe69ceee' | ||
down_revision = 'be06149acd44' | ||
branch_labels = None | ||
depends_on = None | ||
|
||
from alembic import op | ||
import sqlalchemy as sa | ||
|
||
|
||
def upgrade(): | ||
|
||
op.execute(''' | ||
CREATE TABLE adverb_instance_data ( | ||
id BIGSERIAL PRIMARY KEY, | ||
sentence_id BIGINT NOT NULL REFERENCES valency_sentence_data(id), | ||
index INT NOT NULL, | ||
adverb_lex TEXT NOT NULL, | ||
case_str TEXT NOT NULL | ||
); | ||
CREATE TABLE adverb_annotation_data ( | ||
instance_id BIGINT NOT NULL REFERENCES adverb_instance_data(id), | ||
user_id BIGINT NOT NULL REFERENCES public.user(id), | ||
accepted BOOLEAN DEFAULT null, | ||
PRIMARY KEY (instance_id, user_id) | ||
); | ||
CREATE INDEX adverb_instance_data_sentence_id_index | ||
ON adverb_instance_data (sentence_id); | ||
CREATE INDEX adverb_instance_data_adverb_lex_index | ||
ON adverb_instance_data (adverb_lex); | ||
CREATE INDEX adverb_instance_data_case_str_index | ||
ON adverb_instance_data (case_str); | ||
''') | ||
|
||
|
||
def downgrade(): | ||
|
||
op.execute(''' | ||
DROP INDEX adverb_instance_data_sentence_id_index CASCADE; | ||
DROP INDEX adverb_instance_data_adverb_lex_index CASCADE; | ||
DROP INDEX adverb_instance_data_case_str_index CASCADE; | ||
DROP TABLE adverb_instance_data CASCADE; | ||
DROP TABLE adverb_annotation_data CASCADE; | ||
''') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.