/framework/settings/sql/cashmusic_db_sqlite.sql

https://gitlab.com/x33n/platform · SQL · 469 lines · 401 code · 39 blank · 29 comment · 0 complexity · 68d7d4e174b444330d04ff94d18a49e6 MD5 · raw file

  1. --
  2. -- CASH Music platform
  3. -- flavor: SQLite
  4. -- schema version: 8
  5. -- modified: May 28, 2013
  6. BEGIN TRANSACTION;
  7. --
  8. --
  9. -- Section: ASSETS
  10. --
  11. CREATE TABLE assets (
  12. id INTEGER PRIMARY KEY,
  13. user_id integer DEFAULT NULL,
  14. parent_id integer DEFAULT NULL,
  15. location text,
  16. public_url text,
  17. connection_id integer DEFAULT NULL,
  18. type text DEFAULT 'file',
  19. title text,
  20. description text,
  21. metadata text,
  22. public_status integer DEFAULT '0',
  23. size integer DEFAULT '0',
  24. hash text,
  25. creation_date integer DEFAULT NULL,
  26. modification_date integer DEFAULT '0'
  27. );
  28. CREATE INDEX asst_asets_parent_id ON assets (parent_id);
  29. CREATE INDEX assets_user_id ON assets (user_id);
  30. CREATE TABLE assets_analytics (
  31. id INTEGER PRIMARY KEY,
  32. asset_id integer DEFAULT '0',
  33. element_id integer DEFAULT NULL,
  34. access_time integer,
  35. client_ip text,
  36. client_proxy text,
  37. cash_session_id text,
  38. creation_date integer DEFAULT NULL,
  39. modification_date integer DEFAULT '0'
  40. );
  41. CREATE INDEX assets_analytics_asset_id ON assets_analytics (id);
  42. CREATE TABLE assets_analytics_basic (
  43. id INTEGER PRIMARY KEY,
  44. asset_id integer DEFAULT '0',
  45. total integer,
  46. creation_date integer DEFAULT NULL,
  47. modification_date integer DEFAULT '0'
  48. );
  49. --
  50. --
  51. -- Section: CALENDAR
  52. --
  53. CREATE TABLE calendar_events (
  54. id INTEGER PRIMARY KEY,
  55. date integer DEFAULT NULL,
  56. user_id integer DEFAULT NULL,
  57. venue_id integer DEFAULT NULL,
  58. published integer DEFAULT NULL,
  59. cancelled integer DEFAULT NULL,
  60. purchase_url text,
  61. comments text,
  62. creation_date integer DEFAULT NULL,
  63. modification_date integer DEFAULT NULL
  64. );
  65. CREATE INDEX calendar_events_user_id ON calendar_events (user_id);
  66. CREATE TABLE calendar_venues (
  67. id INTEGER PRIMARY KEY,
  68. name text,
  69. address1 text,
  70. address2 text,
  71. city text,
  72. region text,
  73. country text,
  74. postalcode text,
  75. latitude numeric DEFAULT NULL,
  76. longitude numeric DEFAULT NULL,
  77. url text,
  78. phone text,
  79. creation_date integer DEFAULT NULL,
  80. modification_date integer DEFAULT NULL
  81. );
  82. CREATE TABLE calendar_guestlist (
  83. id INTEGER PRIMARY KEY,
  84. event_id integer,
  85. guest_name text,
  86. total_attendees integer DEFAULT '1',
  87. comment text,
  88. creation_date integer DEFAULT NULL,
  89. modification_date integer DEFAULT '0'
  90. );
  91. --
  92. --
  93. -- Section: COMMERCE
  94. --
  95. CREATE TABLE commerce_items (
  96. id integer PRIMARY KEY,
  97. user_id integer,
  98. name text DEFAULT NULL,
  99. description text,
  100. sku text DEFAULT NULL,
  101. price numeric DEFAULT NULL,
  102. flexible_price numeric DEFAULT NULL,
  103. digital_fulfillment integer DEFAULT '0',
  104. physical_fulfillment integer DEFAULT '0',
  105. physical_weight integer,
  106. physical_width integer,
  107. physical_height integer,
  108. physical_depth integer,
  109. available_units integer DEFAULT '0',
  110. variable_pricing integer DEFAULT '0',
  111. fulfillment_asset integer DEFAULT '0',
  112. descriptive_asset integer DEFAULT '0',
  113. creation_date integer DEFAULT '0',
  114. modification_date integer DEFAULT NULL
  115. );
  116. CREATE TABLE commerce_offers (
  117. id integer PRIMARY KEY,
  118. user_id integer,
  119. name text DEFAULT NULL,
  120. description text,
  121. sku text DEFAULT NULL,
  122. price numeric DEFAULT NULL,
  123. flexible_price numeric DEFAULT NULL,
  124. recurring_payment integer DEFAULT '0',
  125. recurring_interval integer DEFAULT '0',
  126. creation_date integer DEFAULT '0',
  127. modification_date integer DEFAULT NULL
  128. );
  129. CREATE TABLE commerce_offers_included_items (
  130. id integer PRIMARY KEY,
  131. offer_id integer,
  132. item_id integer DEFAULT NULL,
  133. creation_date integer DEFAULT NULL,
  134. modification_date integer DEFAULT NULL
  135. );
  136. CREATE TABLE commerce_orders (
  137. id integer PRIMARY KEY,
  138. user_id integer,
  139. customer_user_id integer,
  140. transaction_id integer,
  141. order_contents text,
  142. fulfilled integer DEFAULT '0',
  143. canceled integer DEFAULT '0',
  144. physical integer DEFAULT '0',
  145. digital integer DEFAULT '0',
  146. notes text,
  147. country_code text,
  148. currency text DEFAULT 'USD',
  149. element_id integer,
  150. cash_session_id text,
  151. creation_date integer DEFAULT NULL,
  152. modification_date integer DEFAULT '0'
  153. );
  154. CREATE TABLE commerce_transactions (
  155. id integer PRIMARY KEY,
  156. user_id integer,
  157. connection_id integer,
  158. connection_type text,
  159. service_timestamp text,
  160. service_transaction_id text DEFAULT '',
  161. data_sent text,
  162. data_returned text,
  163. successful integer DEFAULT '0',
  164. gross_price numeric,
  165. service_fee numeric,
  166. currency text DEFAULT 'USD',
  167. status text DEFAULT 'abandoned',
  168. creation_date integer DEFAULT '0',
  169. modification_date integer DEFAULT '0'
  170. );
  171. --
  172. --
  173. -- Section: ELEMENTS
  174. --
  175. CREATE TABLE elements (
  176. id INTEGER PRIMARY KEY,
  177. user_id integer DEFAULT NULL,
  178. template_id integer DEFAULT '-2',
  179. name text,
  180. type text,
  181. options text,
  182. license_id integer DEFAULT '0',
  183. creation_date integer DEFAULT NULL,
  184. modification_date integer DEFAULT NULL
  185. );
  186. CREATE TABLE elements_analytics (
  187. id INTEGER PRIMARY KEY,
  188. element_id integer,
  189. access_method text,
  190. access_location text,
  191. access_action text,
  192. access_data text,
  193. access_time integer,
  194. client_ip text,
  195. client_proxy text,
  196. cash_session_id text,
  197. creation_date integer DEFAULT NULL,
  198. modification_date integer DEFAULT '0'
  199. );
  200. CREATE INDEX elements_analytics_element_id ON elements_analytics (element_id);
  201. CREATE TABLE elements_analytics_basic (
  202. id INTEGER PRIMARY KEY,
  203. element_id integer DEFAULT '0',
  204. data text,
  205. total integer,
  206. creation_date integer DEFAULT NULL,
  207. modification_date integer DEFAULT '0'
  208. );
  209. CREATE TABLE elements_campaigns (
  210. id INTEGER PRIMARY KEY,
  211. user_id integer DEFAULT NULL,
  212. template_id integer DEFAULT '0',
  213. title text,
  214. description text,
  215. metadata text,
  216. elements text,
  217. creation_date integer DEFAULT NULL,
  218. modification_date integer DEFAULT '0'
  219. );
  220. --
  221. --
  222. -- Section: PEOPLE
  223. --
  224. CREATE TABLE people (
  225. id INTEGER PRIMARY KEY,
  226. email_address text DEFAULT '',
  227. password text DEFAULT '',
  228. username text DEFAULT '',
  229. display_name text,
  230. first_name text,
  231. last_name text,
  232. organization text,
  233. address_line1 text,
  234. address_line2 text,
  235. address_city text,
  236. address_region text,
  237. address_postalcode text,
  238. address_country text,
  239. url text,
  240. is_admin integer DEFAULT '0',
  241. data text,
  242. api_key text DEFAULT '',
  243. api_secret text DEFAULT '',
  244. creation_date integer DEFAULT NULL,
  245. modification_date integer DEFAULT NULL
  246. );
  247. CREATE INDEX email ON people (email_address);
  248. CREATE TABLE people_analytics (
  249. id INTEGER PRIMARY KEY,
  250. user_id integer DEFAULT '0',
  251. element_id integer DEFAULT NULL,
  252. access_time integer,
  253. client_ip text,
  254. client_proxy text,
  255. login_method text DEFAULT NULL,
  256. creation_date integer DEFAULT NULL,
  257. modification_date integer DEFAULT '0'
  258. );
  259. CREATE TABLE people_analytics_basic (
  260. id INTEGER PRIMARY KEY,
  261. user_id integer DEFAULT '0',
  262. total integer,
  263. creation_date integer DEFAULT NULL,
  264. modification_date integer DEFAULT '0'
  265. );
  266. CREATE TABLE people_contacts (
  267. id INTEGER PRIMARY KEY,
  268. user_id integer DEFAULT '0',
  269. email_address text,
  270. first_name text,
  271. last_name text,
  272. organization text,
  273. address_line1 text,
  274. address_line2 text,
  275. address_city text,
  276. address_region text,
  277. address_postalcode text,
  278. address_country text,
  279. phone text,
  280. notes text,
  281. links text,
  282. creation_date integer DEFAULT NULL,
  283. modification_date integer DEFAULT NULL
  284. );
  285. CREATE TABLE people_lists (
  286. id INTEGER PRIMARY KEY,
  287. name text DEFAULT '',
  288. description text,
  289. user_id integer,
  290. connection_id integer,
  291. creation_date integer DEFAULT NULL,
  292. modification_date integer DEFAULT '0'
  293. );
  294. CREATE TABLE people_lists_members (
  295. id INTEGER PRIMARY KEY,
  296. user_id integer,
  297. list_id integer,
  298. verification_code text,
  299. verified integer DEFAULT '0',
  300. active integer DEFAULT '1',
  301. initial_comment text,
  302. additional_data text,
  303. creation_date integer DEFAULT NULL,
  304. modification_date integer DEFAULT '0'
  305. );
  306. CREATE INDEX people_lists_members_user_id ON people_lists_members (user_id);
  307. CREATE INDEX people_lists_members_list_id ON people_lists_members (list_id);
  308. CREATE TABLE `people_mailings` (
  309. id INTEGER PRIMARY KEY,
  310. user_id integer,
  311. connection_id integer,
  312. list_id integer,
  313. template_id integer,
  314. subject text,
  315. from_name text,
  316. html_content text,
  317. text_content text,
  318. send_date integer,
  319. creation_date integer DEFAULT NULL,
  320. modification_date integer DEFAULT '0'
  321. );
  322. CREATE TABLE `people_mailings_analytics` (
  323. id INTEGER PRIMARY KEY,
  324. mailing_id integer,
  325. sends integer,
  326. opens_total integer,
  327. opens_unique integer,
  328. opens_mobile integer,
  329. opens_country text,
  330. opens_ids text,
  331. clicks integer,
  332. clicks_urls text,
  333. failures integer,
  334. creation_date integer DEFAULT NULL,
  335. modification_date integer DEFAULT '0'
  336. );
  337. CREATE TABLE people_resetpassword (
  338. id INTEGER PRIMARY KEY,
  339. key text,
  340. user_id integer DEFAULT '0',
  341. creation_date integer DEFAULT NULL,
  342. modification_date integer DEFAULT NULL
  343. );
  344. --
  345. --
  346. -- Section: SYSTEM
  347. --
  348. CREATE TABLE system_analytics (
  349. id INTEGER PRIMARY KEY,
  350. type text,
  351. filter text,
  352. primary_value text,
  353. details text,
  354. user_id integer,
  355. scope_table_alias text DEFAULT NULL,
  356. scope_table_id integer DEFAULT NULL,
  357. creation_date integer DEFAULT NULL,
  358. modification_date integer DEFAULT NULL
  359. );
  360. CREATE TABLE system_connections (
  361. id INTEGER PRIMARY KEY,
  362. name text,
  363. type text,
  364. data text,
  365. user_id integer,
  366. creation_date integer DEFAULT NULL,
  367. modification_date integer DEFAULT NULL
  368. );
  369. CREATE TABLE system_licenses (
  370. id INTEGER PRIMARY KEY,
  371. name text,
  372. description text,
  373. fulltext blob,
  374. url text
  375. creation_date integer DEFAULT NULL,
  376. modification_date integer DEFAULT NULL
  377. );
  378. CREATE TABLE system_lock_codes (
  379. id INTEGER PRIMARY KEY,
  380. uid text,
  381. scope_table_alias text DEFAULT 'elements',
  382. scope_table_id integer,
  383. user_id integer,
  384. claim_date integer DEFAULT NULL,
  385. creation_date integer DEFAULT '0',
  386. modification_date integer DEFAULT NULL
  387. );
  388. CREATE INDEX system_lock_codes_uid ON system_lock_codes (uid);
  389. CREATE INDEX system_lock_codes_user_id ON system_lock_codes (user_id);
  390. CREATE TABLE system_metadata (
  391. id INTEGER PRIMARY KEY,
  392. scope_table_alias text DEFAULT '',
  393. scope_table_id integer DEFAULT '0',
  394. user_id integer DEFAULT '0',
  395. type text,
  396. value text,
  397. creation_date integer DEFAULT NULL,
  398. modification_date integer DEFAULT NULL
  399. );
  400. CREATE INDEX system_metadata_scope_table ON system_metadata (scope_table_alias, scope_table_id);
  401. CREATE TABLE system_sessions (
  402. id INTEGER PRIMARY KEY,
  403. session_id text,
  404. data text,
  405. client_ip text,
  406. client_proxy text,
  407. expiration_date integer,
  408. creation_date integer DEFAULT NULL,
  409. modification_date integer DEFAULT NULL
  410. );
  411. CREATE INDEX system_sessions_session_id ON system_sessions (session_id);
  412. CREATE INDEX system_sessions_expiration_date ON system_sessions (expiration_date);
  413. CREATE TABLE system_settings (
  414. id INTEGER PRIMARY KEY,
  415. type text,
  416. value text,
  417. user_id integer,
  418. creation_date integer DEFAULT NULL,
  419. modification_date integer DEFAULT NULL
  420. );
  421. CREATE TABLE system_templates (
  422. id INTEGER PRIMARY KEY,
  423. type text,
  424. name text,
  425. user_id integer,
  426. template text,
  427. creation_date integer DEFAULT NULL,
  428. modification_date integer DEFAULT NULL
  429. );
  430. COMMIT;