File indexing completed on 2024-09-08 03:28:58
0001 #!/usr/bin/python 0002 import sqlite3 0003 conn = sqlite3.connect('../skycomponents.db') 0004 cur = conn.cursor() 0005 try: 0006 cur.execute('''DROP TABLE ObjectDesignation''') 0007 except: 0008 pass 0009 try: 0010 cur.execute('''DROP TABLE Catalog''') 0011 except: 0012 pass 0013 try: 0014 cur.execute('''DROP TABLE DSO''') 0015 except: 0016 pass 0017 0018 cur.execute('''CREATE TABLE ObjectDesignation ( 0019 id INTEGER NOT NULL DEFAULT NULL PRIMARY KEY, 0020 id_Catalog INTEGER DEFAULT NULL REFERENCES Catalog (id), 0021 UID_DSO INTEGER DEFAULT NULL REFERENCES DSO (UID), 0022 LongName MEDIUMTEXT DEFAULT NULL, 0023 IDNumber INTEGER DEFAULT NULL 0024 ); 0025 '''); 0026 0027 cur.execute('''CREATE TABLE Catalog ( 0028 id INTEGER DEFAULT NULL PRIMARY KEY AUTOINCREMENT, 0029 Name CHAR NOT NULL DEFAULT 'NULL', 0030 Prefix CHAR DEFAULT NULL, 0031 Color CHAR DEFAULT '#CC0000', 0032 Epoch FLOAT DEFAULT 2000.0, 0033 Author CHAR DEFAULT NULL, 0034 License MEDIUMTEXT DEFAULT NULL 0035 ); 0036 '''); 0037 0038 cur.execute('''CREATE TABLE DSO ( 0039 UID INTEGER DEFAULT NULL PRIMARY KEY AUTOINCREMENT, 0040 RA DOUBLE NOT NULL DEFAULT 0.0, 0041 Dec DOUBLE DEFAULT 0.0, 0042 Type INTEGER DEFAULT NULL, 0043 Magnitude DECIMAL DEFAULT NULL, 0044 PositionAngle INTEGER DEFAULT NULL, 0045 MajorAxis FLOAT NOT NULL DEFAULT NULL, 0046 MinorAxis FLOAT DEFAULT NULL, 0047 Flux FLOAT DEFAULT NULL, 0048 Add1 VARCHAR DEFAULT NULL, 0049 Add2 INTEGER DEFAULT NULL, 0050 Add3 INTEGER DEFAULT NULL, 0051 Add4 INTEGER DEFAULT NULL 0052 ); 0053 '''); 0054 0055