Skip to content

Commit

Permalink
Merging.
Browse files Browse the repository at this point in the history
  • Loading branch information
rafaelthca committed Oct 23, 2018
2 parents b391ac5 + 4a7aef7 commit 86a3276
Show file tree
Hide file tree
Showing 464 changed files with 21,460 additions and 15,374 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Expand Up @@ -13,3 +13,5 @@ OmniDB/chat
OmniDB/OmniDB_app/static/chat*
omnidb_app/node_modules/
omnidb_app/omnidb-gui*
omnidb_app/package-lock.json

6 changes: 3 additions & 3 deletions Dockerfile
Expand Up @@ -7,9 +7,9 @@ RUN apt-get update \
RUN mkdir /app
WORKDIR /app

RUN wget -q https://omnidb.org/dist/2.11.0/omnidb-server_2.11.0-debian-amd64.deb \
&& dpkg -i /app/omnidb-server_2.11.0-debian-amd64.deb \
&& rm -rf omnidb-server_2.11.0-debian-amd64.deb
RUN wget -q https://omnidb.org/dist/2.12.0/omnidb-server_2.12.0-debian-amd64.deb \
&& dpkg -i /app/omnidb-server_2.12.0-debian-amd64.deb \
&& rm -rf omnidb-server_2.12.0-debian-amd64.deb

EXPOSE 8000
EXPOSE 25482
Expand Down
4 changes: 2 additions & 2 deletions OmniDB/OmniDB/custom_settings.py
@@ -1,7 +1,7 @@
import os

OMNIDB_VERSION = 'OmniDB 2.11.0'
OMNIDB_SHORT_VERSION = '2.11.0'
OMNIDB_VERSION = 'OmniDB 2.12.0'
OMNIDB_SHORT_VERSION = '2.12.0'
DEV_MODE = True
DESKTOP_MODE = False
HOME_DIR = None
Expand Down
Expand Up @@ -380,19 +380,21 @@ INSERT INTO themes VALUES(34,'tomorrow_night_eighties','dark');--omnidb--
INSERT INTO themes VALUES(35,'twilight','dark');--omnidb--
INSERT INTO themes VALUES(36,'vibrant_ink','dark');--omnidb--

CREATE TABLE users (user_id integer not null,
CREATE TABLE users (
user_id integer not null,
user_name varchar(30),
password varchar(100),
theme_id integer,
editor_font_size varchar(10),
chat_enabled integer,
super_user integer,
user_key text,
csv_encoding varchar(20),
csv_delimiter varchar(10),
constraint pk_users primary key (user_id),
constraint users_fk_0 foreign key (theme_id) references themes (theme_id) on update NO ACTION on delete NO ACTION,
constraint uq_users_0 unique (user_name)
);--omnidb--
INSERT INTO users VALUES(1,'admin','8IqxKdQ=',1,'14',1,1,'0c4a137f-9918-4c0b-af45-480deef6f760');--omnidb--
INSERT INTO users VALUES(1,'admin','8IqxKdQ=',1,'14',1,1,'utf-8',';');--omnidb--

CREATE TABLE messages (
mes_in_code integer not null,
Expand Down Expand Up @@ -509,15 +511,18 @@ CREATE TABLE command_list (
cl_st_end text,
cl_st_status text,
cl_st_duration text,
conn_id integer not null,
constraint pk_command_list primary key (cl_in_codigo),
constraint command_list_fk_0 foreign key (user_id) references users (user_id) on update CASCADE on delete CASCADE
constraint command_list_fk_0 foreign key (user_id) references users (user_id) on update CASCADE on delete CASCADE,
constraint fk_cl_conn foreign key (conn_id) references connections (conn_id) on update CASCADE on delete CASCADE
);--omnidb--

CREATE TABLE tabs (
conn_id integer not null,
user_id integer not null,
tab_id integer not null,
snippet text,
title text,
constraint fk_tabs_conn foreign key (conn_id) references connections (conn_id) on update CASCADE on delete CASCADE,
constraint fk_tabs_users foreign key (user_id) references users (user_id) on update CASCADE on delete CASCADE
);--omnidb--
Expand Down Expand Up @@ -593,6 +598,7 @@ INSERT INTO shortcuts VALUES(NULL,'shortcut_right_outer_tab',0,0,1,0,'.');--omni
INSERT INTO shortcuts VALUES(NULL,'shortcut_cancel_query',0,0,1,0,'C');--omnidb--
INSERT INTO shortcuts VALUES(NULL,'shortcut_next_console_command',1,0,0,0,'ARROWDOWN');--omnidb--
INSERT INTO shortcuts VALUES(NULL,'shortcut_previous_console_command',1,0,0,0,'ARROWUP');--omnidb--
INSERT INTO shortcuts VALUES(NULL,'shortcut_autocomplete',1,0,0,0,'SPACE');--omnidb--

CREATE TABLE console_history (
user_id integer,
Expand All @@ -607,4 +613,4 @@ CREATE TABLE version (
ver_id text not null,
constraint pk_versions primary key (ver_id)
);--omnidb--
INSERT INTO version VALUES('2.11.0');--omnidb--
INSERT INTO version VALUES('2.12.0');--omnidb--
66 changes: 66 additions & 0 deletions OmniDB/OmniDB/migrations/omnidb_2.11.0_2.12.0.sql
@@ -0,0 +1,66 @@
DROP TABLE command_list;--omnidb--

CREATE TABLE command_list (
user_id integer not null,
cl_in_codigo integer not null,
cl_st_command text,
cl_st_start text,
cl_st_end text,
cl_st_status text,
cl_st_duration text,
conn_id integer not null,
constraint pk_command_list primary key (cl_in_codigo),
constraint command_list_fk_0 foreign key (user_id) references users (user_id) on update CASCADE on delete CASCADE,
constraint command_list_fk_1 foreign key (conn_id) references connections (conn_id) on update CASCADE on delete CASCADE
);--omnidb--

CREATE TABLE users_bak AS
SELECT *
FROM users;--omnidb--

DROP TABLE users;--omnidb--

CREATE TABLE users (
user_id integer not null,
user_name varchar(30),
password varchar(100),
theme_id integer,
editor_font_size varchar(10),
chat_enabled integer,
super_user integer,
csv_encoding varchar(20),
csv_delimiter varchar(10),
constraint pk_users primary key (user_id),
constraint users_fk_0 foreign key (theme_id) references themes (theme_id) on update NO ACTION on delete NO ACTION,
constraint uq_users_0 unique (user_name)
);--omnidb--

INSERT INTO users (
user_id,
user_name,
password,
theme_id,
editor_font_size,
chat_enabled,
super_user,
csv_encoding,
csv_delimiter
)
SELECT user_id,
user_name,
password,
theme_id,
editor_font_size,
chat_enabled,
super_user,
'utf-8' AS csv_encoding,
';' AS csv_delimiter
FROM users_bak;--omnidb--

DROP TABLE users_bak;--omnidb--

ALTER TABLE tabs ADD COLUMN title text;--omnidb--

INSERT INTO shortcuts VALUES(NULL,'shortcut_autocomplete',1,0,0,0,'SPACE');--omnidb--

UPDATE version SET ver_id = '2.12.0';--omnidb--
2 changes: 2 additions & 0 deletions OmniDB/OmniDB/migrations/omnidb_2.7.0_2.8.0.sql
Expand Up @@ -4,11 +4,13 @@ ALTER TABLE connections ADD COLUMN ssh_user varchar(100);--omnidb--
ALTER TABLE connections ADD COLUMN ssh_password varchar(100);--omnidb--
ALTER TABLE connections ADD COLUMN ssh_key text;--omnidb--
ALTER TABLE connections ADD COLUMN use_tunnel integer;--omnidb--

UPDATE connections
SET ssh_server = '',
ssh_port = '22',
ssh_user = '',
ssh_password = '',
ssh_key = '',
use_tunnel = ''--omnidb--

UPDATE version SET ver_id = '2.8.0';--omnidb--
6 changes: 4 additions & 2 deletions OmniDB/OmniDB/user_database.py
Expand Up @@ -6,7 +6,7 @@
import OmniDB_app.include.OmniDatabase as OmniDatabase

migrations = {
'0.0.0': ('2.11.0', os.path.join(settings.BASE_DIR, 'OmniDB/migrations/omnidb_0.0.0_2.11.0.sql')),
'0.0.0': ('2.12.0', os.path.join(settings.BASE_DIR, 'OmniDB/migrations/omnidb_0.0.0_2.12.0.sql')),
'2.4.0': ('2.4.1', os.path.join(settings.BASE_DIR, 'OmniDB/migrations/omnidb_2.4.0_2.4.1.sql')),
'2.4.1': ('2.5.0', os.path.join(settings.BASE_DIR, 'OmniDB/migrations/omnidb_2.4.1_2.5.0.sql')),
'2.5.0': ('2.6.0', os.path.join(settings.BASE_DIR, 'OmniDB/migrations/omnidb_2.5.0_2.6.0.sql')),
Expand All @@ -15,6 +15,7 @@
'2.8.0': ('2.9.0', os.path.join(settings.BASE_DIR, 'OmniDB/migrations/omnidb_2.8.0_2.9.0.sql')),
'2.9.0': ('2.10.0', os.path.join(settings.BASE_DIR, 'OmniDB/migrations/omnidb_2.9.0_2.10.0.sql')),
'2.10.0': ('2.11.0', os.path.join(settings.BASE_DIR, 'OmniDB/migrations/omnidb_2.10.0_2.11.0.sql')),
'2.11.0': ('2.12.0', os.path.join(settings.BASE_DIR, 'OmniDB/migrations/omnidb_2.11.0_2.12.0.sql')),
}

def get_current_version(p_database):
Expand All @@ -36,6 +37,7 @@ def migrate(p_database, p_current_version):
p_database.v_connection.Execute(sql)
p_database.v_connection.Execute('COMMIT;')
p_database.v_connection.Close()
p_database.v_connection.Execute('VACUUM;')
print('OmniDB successfully migrated user database from version {0} to version {1}'.format(p_current_version, next_version))
return True
except Exception as exc:
Expand All @@ -46,7 +48,7 @@ def migrate(p_database, p_current_version):
return False

def work():
database = OmniDatabase.Generic.InstantiateDatabase('sqlite','','',settings.OMNIDB_DATABASE,'','','0','')
database = OmniDatabase.Generic.InstantiateDatabase('sqlite','','',settings.OMNIDB_DATABASE,'','','0','',p_foreignkeys=False)
current_version = get_current_version(database)
if current_version != settings.OMNIDB_SHORT_VERSION:
if int(current_version.replace('.', '')) < int(settings.OMNIDB_SHORT_VERSION.replace('.', '')):
Expand Down

0 comments on commit 86a3276

Please sign in to comment.