[update] change table name project_report -> project_reports & project_meta -> project_metas

This commit is contained in:
peterlu14
2022-12-28 13:21:00 +08:00
parent 64412f9376
commit 9c054bd733
5 changed files with 11 additions and 7 deletions
+2 -1
View File
@@ -366,7 +366,8 @@ sudo vim /etc/apache2/sites-available/000-default.conf
# ChangeLog
[2022.12.28]
change meta_project_info to project_meta
change meta_project_info to project_metas
change project_report to project_reports
alter table project_meta column cycle type string to jsonb
[2022.11.16]
+1 -1
View File
@@ -6,7 +6,7 @@ from sqlalchemy.dialects.postgresql import JSONB
from .base import Base
class MetaProjectInfo(Base):
__tablename__ = "project_meta"
__tablename__ = "project_metas"
id = Column(Integer, primary_key=True)
project = Column(String(36))
+1 -1
View File
@@ -6,7 +6,7 @@ from sqlalchemy.dialects.postgresql import JSONB
from .base import Base
class ProjectReport(Base):
__tablename__ = "project_report"
__tablename__ = "project_reports"
id = Column(Integer, primary_key=True)
name = Column(String)
+1 -1
View File
@@ -553,7 +553,7 @@ class DataBaseProcess(Process):
return True
def project_insert(self, device_id, _data):
sql_str = 'INSERT INTO "public"."project_meta" ('
sql_str = 'INSERT INTO "public"."project_metas" ('
sql_set = []
for item in _data.keys():
sql_str = sql_str + str(item) + ', '
+6 -3
View File
@@ -19,8 +19,11 @@ sudo su -c "psql -d postgres -c \"ALTER TABLE recording_data_metas ADD COLUMN IF
# remove default controller info
sudo su -c "psql -d postgres -c \"DELETE FROM controllers WHERE name='WTP_NONE';\"" postgres
# change table name from meta_project_info to project_meta
sudo su -c "psql -d postgres -c \"ALTER TABLE IF EXISTS meta_project_info RENAME TO project_meta;\"" postgres
# change table name from meta_project_info to project_metas
sudo su -c "psql -d postgres -c \"ALTER TABLE IF EXISTS meta_project_info RENAME TO project_metas;\"" postgres
# change table name from project_report to project_reports
sudo su -c "psql -d postgres -c \"ALTER TABLE IF EXISTS project_report RENAME TO project_reports;\"" postgres
# change table project_meta column cycle to type jsonb
sudo su -c "psql -d postgres -c \"ALTER TABLE project_meta ALTER COLUMN cycle type jsonb USING (cycle::jsonb);\"" postgres
sudo su -c "psql -d postgres -c \"ALTER TABLE project_metas ALTER COLUMN cycle type jsonb USING (cycle::jsonb);\"" postgres