added security type models, improved cashflow, bug- and layout fixes along the way
[smr.git] / gui / db / structure.sql
bloba3c1806b5a21167775b119167801c0f18e706d81
1 -- MySQL dump 10.14  Distrib 5.5.41-MariaDB, for Linux (x86_64)
2 --
3 -- Host: localhost    Database: smr_test
4 -- ------------------------------------------------------
5 -- Server version       5.5.41-MariaDB
7 /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
8 /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
9 /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
10 /*!40101 SET NAMES utf8 */;
11 /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
12 /*!40103 SET TIME_ZONE='+00:00' */;
13 /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
14 /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
15 /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
16 /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
19 -- Table structure for table `access`
22 DROP TABLE IF EXISTS `access`;
23 /*!40101 SET @saved_cs_client     = @@character_set_client */;
24 /*!40101 SET character_set_client = utf8 */;
25 CREATE TABLE `access` (
26   `id_user` int(11) NOT NULL DEFAULT '0',
27   `name` varchar(32) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
28   `access` tinyint(1) DEFAULT NULL
29 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
30 /*!40101 SET character_set_client = @saved_cs_client */;
33 -- Table structure for table `comment`
36 DROP TABLE IF EXISTS `comment`;
37 /*!40101 SET @saved_cs_client     = @@character_set_client */;
38 /*!40101 SET character_set_client = utf8 */;
39 CREATE TABLE `comment` (
40   `id` int(11) NOT NULL AUTO_INCREMENT,
41   `id_user` int(11) NOT NULL,
42   `date` int(11) NOT NULL,
43   `title` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
44   `comment` mediumtext COLLATE utf8_unicode_ci,
45   PRIMARY KEY (`id`)
46 ) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
47 /*!40101 SET character_set_client = @saved_cs_client */;
50 -- Table structure for table `dividend`
53 DROP TABLE IF EXISTS `dividend`;
54 /*!40101 SET @saved_cs_client     = @@character_set_client */;
55 /*!40101 SET character_set_client = utf8 */;
56 CREATE TABLE `dividend` (
57   `id` int(11) NOT NULL AUTO_INCREMENT,
58   `id_security` int(11) NOT NULL,
59   `exdate` int(11) NOT NULL,
60   `paid` float NOT NULL DEFAULT '0',
61   `id_position` int(11) NOT NULL DEFAULT '0',
62   `id_order` int(11) NOT NULL DEFAULT '0',
63   PRIMARY KEY (`id`)
64 ) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
65 /*!40101 SET character_set_client = @saved_cs_client */;
68 -- Table structure for table `document`
71 DROP TABLE IF EXISTS `document`;
72 /*!40101 SET @saved_cs_client     = @@character_set_client */;
73 /*!40101 SET character_set_client = utf8 */;
74 CREATE TABLE `document` (
75   `id` int(11) NOT NULL AUTO_INCREMENT,
76   `id_user` int(11) NOT NULL,
77   `mimetype` varchar(50) COLLATE utf8_unicode_ci NOT NULL,
78   `filename` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
79   `size` int(11) NOT NULL,
80   `date_upload` int(11) NOT NULL,
81   `comment` text COLLATE utf8_unicode_ci,
82   PRIMARY KEY (`id`)
83 ) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
84 /*!40101 SET character_set_client = @saved_cs_client */;
87 -- Table structure for table `document_assign`
90 DROP TABLE IF EXISTS `document_assign`;
91 /*!40101 SET @saved_cs_client     = @@character_set_client */;
92 /*!40101 SET character_set_client = utf8 */;
93 CREATE TABLE `document_assign` (
94   `id_document` int(11) NOT NULL AUTO_INCREMENT,
95   `id_portfolio` int(11) DEFAULT NULL,
96   `id_position` int(11) DEFAULT NULL,
97   `id_order` int(11) DEFAULT NULL,
98   `id_security` int(11) DEFAULT NULL,
99   `is_assigned` tinyint(1) DEFAULT NULL,
100   PRIMARY KEY (`id_document`),
101   UNIQUE KEY `id_document` (`id_document`) USING BTREE
102 ) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
103 /*!40101 SET character_set_client = @saved_cs_client */;
106 -- Table structure for table `document_data`
109 DROP TABLE IF EXISTS `document_data`;
110 /*!40101 SET @saved_cs_client     = @@character_set_client */;
111 /*!40101 SET character_set_client = utf8 */;
112 CREATE TABLE `document_data` (
113   `id_document` int(11) NOT NULL AUTO_INCREMENT,
114   `content` mediumblob NOT NULL,
115   PRIMARY KEY (`id_document`),
116   UNIQUE KEY `id_document` (`id_document`) USING BTREE
117 ) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
118 /*!40101 SET character_set_client = @saved_cs_client */;
121 -- Table structure for table `figure_data`
124 DROP TABLE IF EXISTS `figure_data`;
125 /*!40101 SET @saved_cs_client     = @@character_set_client */;
126 /*!40101 SET character_set_client = utf8 */;
127 CREATE TABLE `figure_data` (
128   `id` int(11) NOT NULL AUTO_INCREMENT,
129   `id_figure_var` int(11) NOT NULL,
130   `id_security` int(11) NOT NULL,
131   `date` int(11) NOT NULL,
132   `period` varchar(25) COLLATE utf8_unicode_ci NOT NULL,
133   `analyst` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
134   `value` float NOT NULL,
135   `is_expected` tinyint(1) DEFAULT NULL,
136   `is_audited` tinyint(1) DEFAULT NULL,
137   `comment` text COLLATE utf8_unicode_ci,
138   PRIMARY KEY (`id`)
139 ) ENGINE=InnoDB AUTO_INCREMENT=15 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
140 /*!40101 SET character_set_client = @saved_cs_client */;
143 -- Table structure for table `figure_var`
146 DROP TABLE IF EXISTS `figure_var`;
147 /*!40101 SET @saved_cs_client     = @@character_set_client */;
148 /*!40101 SET character_set_client = utf8 */;
149 CREATE TABLE `figure_var` (
150   `id` int(11) NOT NULL AUTO_INCREMENT,
151   `id_user` int(11) NOT NULL DEFAULT '0',
152   `name` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
153   `unit` varchar(3) COLLATE utf8_unicode_ci DEFAULT NULL,
154   `expression` mediumtext COLLATE utf8_unicode_ci,
155   `comment` text COLLATE utf8_unicode_ci,
156   PRIMARY KEY (`id`)
157 ) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
158 /*!40101 SET character_set_client = @saved_cs_client */;
161 -- Table structure for table `news`
164 DROP TABLE IF EXISTS `news`;
165 /*!40101 SET @saved_cs_client     = @@character_set_client */;
166 /*!40101 SET character_set_client = utf8 */;
167 CREATE TABLE `news` (
168   `id_user` int(11) NOT NULL DEFAULT '0',
169   `id_news_feed` int(11) NOT NULL DEFAULT '0',
170   `is_subscribed` tinyint(1) NOT NULL DEFAULT '0'
171 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
172 /*!40101 SET character_set_client = @saved_cs_client */;
175 -- Table structure for table `news_assign`
178 DROP TABLE IF EXISTS `news_assign`;
179 /*!40101 SET @saved_cs_client     = @@character_set_client */;
180 /*!40101 SET character_set_client = utf8 */;
181 CREATE TABLE `news_assign` (
182   `id_news_item` int(11) NOT NULL DEFAULT '0',
183   `id_position` int(11) NOT NULL DEFAULT '0',
184   `is_assigned` tinyint(1) DEFAULT NULL,
185   UNIQUE KEY `NID` (`id_news_item`,`id_position`) USING BTREE
186 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
187 /*!40101 SET character_set_client = @saved_cs_client */;
190 -- Table structure for table `news_feed`
193 DROP TABLE IF EXISTS `news_feed`;
194 /*!40101 SET @saved_cs_client     = @@character_set_client */;
195 /*!40101 SET character_set_client = utf8 */;
196 CREATE TABLE `news_feed` (
197   `id` int(11) NOT NULL AUTO_INCREMENT,
198   `url` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
199   `fetch_feed` tinyint(1) DEFAULT '1',
200   `last_fetched` int(11) DEFAULT '0',
201   `title` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
202   `link` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
203   `description` text COLLATE utf8_unicode_ci,
204   `language` varchar(10) COLLATE utf8_unicode_ci DEFAULT NULL,
205   `ttl` int(11) DEFAULT NULL,
206   `copyright` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
207   `count_total` int(11) NOT NULL,
208   PRIMARY KEY (`id`)
209 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
210 /*!40101 SET character_set_client = @saved_cs_client */;
213 -- Table structure for table `news_item`
216 DROP TABLE IF EXISTS `news_item`;
217 /*!40101 SET @saved_cs_client     = @@character_set_client */;
218 /*!40101 SET character_set_client = utf8 */;
219 CREATE TABLE `news_item` (
220   `id` int(11) NOT NULL AUTO_INCREMENT,
221   `id_news_feed` int(11) NOT NULL DEFAULT '0',
222   `identifier` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
223   `identifier_method` varchar(0) COLLATE utf8_unicode_ci NOT NULL,
224   `fetched` int(11) NOT NULL,
225   `title` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
226   `link` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
227   `description` text COLLATE utf8_unicode_ci,
228   `pubDate` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL,
229   PRIMARY KEY (`id`)
230 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
231 /*!40101 SET character_set_client = @saved_cs_client */;
234 -- Table structure for table `news_read`
237 DROP TABLE IF EXISTS `news_read`;
238 /*!40101 SET @saved_cs_client     = @@character_set_client */;
239 /*!40101 SET character_set_client = utf8 */;
240 CREATE TABLE `news_read` (
241   `id_news_feed` int(11) NOT NULL,
242   `id_user` int(11) NOT NULL,
243   `lastread` int(11) DEFAULT NULL,
244   `count_notread` int(11) NOT NULL
245 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
246 /*!40101 SET character_set_client = @saved_cs_client */;
249 -- Table structure for table `order`
252 DROP TABLE IF EXISTS `order`;
253 /*!40101 SET @saved_cs_client     = @@character_set_client */;
254 /*!40101 SET character_set_client = utf8 */;
255 CREATE TABLE `order` (
256   `id` int(11) NOT NULL AUTO_INCREMENT,
257   `id_position` int(11) NOT NULL,
258   `issued` int(11) NOT NULL DEFAULT '0',
259   `expire` int(11) NOT NULL DEFAULT '0',
260   `type` varchar(10) COLLATE utf8_unicode_ci NOT NULL DEFAULT 'buy',
261   `shares` double NOT NULL DEFAULT '0',
262   `limit` double NOT NULL DEFAULT '0',
263   `addon` varchar(10) COLLATE utf8_unicode_ci NOT NULL DEFAULT 'none',
264   `exchange` varchar(25) COLLATE utf8_unicode_ci DEFAULT NULL,
265   `quote` double NOT NULL DEFAULT '0',
266   `provision` float DEFAULT NULL,
267   `courtage` float DEFAULT NULL,
268   `expense` float DEFAULT NULL,
269   `comment` mediumtext COLLATE utf8_unicode_ci,
270   `is_canceled` tinyint(1) DEFAULT NULL,
271   `triggered_by_order` int(11) DEFAULT NULL,
272   `accrued_interest` float NOT NULL DEFAULT '0',
273   PRIMARY KEY (`id`)
274 ) ENGINE=InnoDB AUTO_INCREMENT=141 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
275 /*!40101 SET character_set_client = @saved_cs_client */;
278 -- Table structure for table `organization`
281 DROP TABLE IF EXISTS `organization`;
282 /*!40101 SET @saved_cs_client     = @@character_set_client */;
283 /*!40101 SET character_set_client = utf8 */;
284 CREATE TABLE `organization` (
285   `id` int(11) NOT NULL AUTO_INCREMENT,
286   `name` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
287   `url` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
288   `contact_email` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
289   `description` text COLLATE utf8_unicode_ci,
290   PRIMARY KEY (`id`)
291 ) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
292 /*!40101 SET character_set_client = @saved_cs_client */;
295 -- Table structure for table `portfolio`
298 DROP TABLE IF EXISTS `portfolio`;
299 /*!40101 SET @saved_cs_client     = @@character_set_client */;
300 /*!40101 SET character_set_client = utf8 */;
301 CREATE TABLE `portfolio` (
302   `id` int(11) NOT NULL AUTO_INCREMENT,
303   `id_user` int(11) NOT NULL,
304   `name` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
305   `type` varchar(0) COLLATE utf8_unicode_ci NOT NULL,
306   `date_created` int(11) NOT NULL,
307   `taxallowance` float DEFAULT NULL,
308   `order` tinyint(4) DEFAULT '0',
309   `comment` text COLLATE utf8_unicode_ci,
310   PRIMARY KEY (`id`)
311 ) ENGINE=InnoDB AUTO_INCREMENT=25 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
312 /*!40101 SET character_set_client = @saved_cs_client */;
315 -- Table structure for table `position`
318 DROP TABLE IF EXISTS `position`;
319 /*!40101 SET @saved_cs_client     = @@character_set_client */;
320 /*!40101 SET character_set_client = utf8 */;
321 CREATE TABLE `position` (
322   `id` int(11) NOT NULL AUTO_INCREMENT,
323   `id_portfolio` int(11) NOT NULL,
324   `id_security` int(11) NOT NULL,
325   `closed` int(11) DEFAULT '0',
326   `comment` text COLLATE utf8_unicode_ci NOT NULL,
327   PRIMARY KEY (`id`)
328 ) ENGINE=InnoDB AUTO_INCREMENT=38 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
329 /*!40101 SET character_set_client = @saved_cs_client */;
332 -- Table structure for table `position_revision`
335 DROP TABLE IF EXISTS `position_revision`;
336 /*!40101 SET @saved_cs_client     = @@character_set_client */;
337 /*!40101 SET character_set_client = utf8 */;
338 CREATE TABLE `position_revision` (
339   `id` int(11) NOT NULL AUTO_INCREMENT,
340   `id_order` int(11) NOT NULL,
341   `id_position` int(11) NOT NULL,
342   `date` int(11) NOT NULL DEFAULT '0',
343   `shares` double NOT NULL DEFAULT '0',
344   `invested` float NOT NULL DEFAULT '0',
345   PRIMARY KEY (`id`)
346 ) ENGINE=InnoDB AUTO_INCREMENT=133 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
347 /*!40101 SET character_set_client = @saved_cs_client */;
350 -- Table structure for table `quote`
353 DROP TABLE IF EXISTS `quote`;
354 /*!40101 SET @saved_cs_client     = @@character_set_client */;
355 /*!40101 SET character_set_client = utf8 */;
356 CREATE TABLE `quote` (
357   `id` int(11) NOT NULL AUTO_INCREMENT,
358   `id_security` int(11) NOT NULL DEFAULT '0',
359   `date` int(11) NOT NULL DEFAULT '0',
360   `quote` double NOT NULL DEFAULT '0',
361   `low` double DEFAULT NULL,
362   `high` double DEFAULT NULL,
363   `volume` int(11) DEFAULT NULL,
364   `exchange` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL,
365   PRIMARY KEY (`id`)
366 ) ENGINE=InnoDB AUTO_INCREMENT=1059 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
367 /*!40101 SET character_set_client = @saved_cs_client */;
370 -- Table structure for table `quoterecord`
373 DROP TABLE IF EXISTS `quoterecord`;
374 /*!40101 SET @saved_cs_client     = @@character_set_client */;
375 /*!40101 SET character_set_client = utf8 */;
376 CREATE TABLE `quoterecord` (
377   `id` int(11) NOT NULL AUTO_INCREMENT,
378   `id_user` int(11) NOT NULL,
379   `id_security` int(11) NOT NULL,
380   `id_quote` int(11) NOT NULL,
381   `created` int(11) NOT NULL,
382   `column` varchar(25) COLLATE utf8_unicode_ci NOT NULL,
383   `comment` text COLLATE utf8_unicode_ci,
384   `is_pivotal_point` tinyint(1) DEFAULT NULL,
385   `is_signal` tinyint(1) DEFAULT NULL,
386   `is_uphit` tinyint(1) DEFAULT NULL,
387   `is_downhit` tinyint(1) DEFAULT NULL,
388   PRIMARY KEY (`id`)
389 ) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
390 /*!40101 SET character_set_client = @saved_cs_client */;
393 -- Table structure for table `quoterecord_rule`
396 DROP TABLE IF EXISTS `quoterecord_rule`;
397 /*!40101 SET @saved_cs_client     = @@character_set_client */;
398 /*!40101 SET character_set_client = utf8 */;
399 CREATE TABLE `quoterecord_rule` (
400   `id` int(11) NOT NULL AUTO_INCREMENT,
401   `id_user` int(11) NOT NULL,
402   `last_modified` int(11) DEFAULT NULL,
403   `order` int(11) DEFAULT NULL,
404   `related_columns` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
405   `name` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
406   `rule` text COLLATE utf8_unicode_ci,
407   PRIMARY KEY (`id`)
408 ) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
409 /*!40101 SET character_set_client = @saved_cs_client */;
412 -- Table structure for table `quoterecord_threshold`
415 DROP TABLE IF EXISTS `quoterecord_threshold`;
416 /*!40101 SET @saved_cs_client     = @@character_set_client */;
417 /*!40101 SET character_set_client = utf8 */;
418 CREATE TABLE `quoterecord_threshold` (
419   `id` int(11) NOT NULL AUTO_INCREMENT,
420   `id_user` int(11) NOT NULL,
421   `id_security` int(11) NOT NULL,
422   `quote_sensitivity` double DEFAULT NULL,
423   `hit_sensitivity` double DEFAULT NULL,
424   PRIMARY KEY (`id`)
425 ) ENGINE=InnoDB AUTO_INCREMENT=16 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
426 /*!40101 SET character_set_client = @saved_cs_client */;
429 -- Table structure for table `schema_migrations`
432 DROP TABLE IF EXISTS `schema_migrations`;
433 /*!40101 SET @saved_cs_client     = @@character_set_client */;
434 /*!40101 SET character_set_client = utf8 */;
435 CREATE TABLE `schema_migrations` (
436   `version` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
437   UNIQUE KEY `unique_schema_migrations` (`version`)
438 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
439 /*!40101 SET character_set_client = @saved_cs_client */;
442 -- Table structure for table `security`
445 DROP TABLE IF EXISTS `security`;
446 /*!40101 SET @saved_cs_client     = @@character_set_client */;
447 /*!40101 SET character_set_client = utf8 */;
448 CREATE TABLE `security` (
449   `id` int(11) NOT NULL AUTO_INCREMENT,
450   `id_security_quotesource` int(11) DEFAULT NULL,
451   `id_security_symbolextension` int(11) DEFAULT NULL,
452   `fetch_quote` tinyint(1) DEFAULT '1',
453   `symbol` varchar(32) COLLATE utf8_unicode_ci DEFAULT NULL,
454   `brief` varchar(255) COLLATE utf8_unicode_ci NOT NULL DEFAULT '--',
455   `url` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
456   `description` text COLLATE utf8_unicode_ci,
457   `type` int(11) DEFAULT '0',
458   `id_organization` int(11) NOT NULL DEFAULT '1',
459   `collateral_coverage_ratio` decimal(2,0) NOT NULL DEFAULT '0',
460   PRIMARY KEY (`id`),
461   KEY `fk_rails_79816ed41e` (`id_organization`) USING BTREE,
462   CONSTRAINT `fk_rails_79816ed41e` FOREIGN KEY (`id_organization`) REFERENCES `organization` (`id`)
463 ) ENGINE=InnoDB AUTO_INCREMENT=114 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
464 /*!40101 SET character_set_client = @saved_cs_client */;
467 -- Table structure for table `security_bond`
470 DROP TABLE IF EXISTS `security_bond`;
471 /*!40101 SET @saved_cs_client     = @@character_set_client */;
472 /*!40101 SET character_set_client = utf8 */;
473 CREATE TABLE `security_bond` (
474   `id` int(11) NOT NULL AUTO_INCREMENT,
475   `id_security` int(11) NOT NULL,
476   `type` int(11) NOT NULL DEFAULT '0',
477   `interest_method` int(11) NOT NULL DEFAULT '0',
478   `denomination` int(11) NOT NULL DEFAULT '1000',
479   `currency` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
480   `coupon` float NOT NULL DEFAULT '0',
481   `coupon_interval` int(11) NOT NULL DEFAULT '12',
482   `redemption_price` float NOT NULL DEFAULT '100',
483   `redemption_installments` int(11) NOT NULL DEFAULT '1',
484   `redemption_interval` int(11) NOT NULL DEFAULT '12',
485   `date_maturity` bigint(20) NOT NULL DEFAULT '0',
486   `date_first_coupon` bigint(20) NOT NULL DEFAULT '0',
487   `date_last_coupon` bigint(20) NOT NULL DEFAULT '0',
488   `is_subordinated` tinyint(1) DEFAULT '0',
489   `is_callable` tinyint(1) DEFAULT '0',
490   `is_stepup` tinyint(1) DEFAULT '0',
491   `is_stepdown` tinyint(1) DEFAULT '0',
492   `comment` text COLLATE utf8_unicode_ci,
493   PRIMARY KEY (`id`)
494 ) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
495 /*!40101 SET character_set_client = @saved_cs_client */;
498 -- Table structure for table `security_fund`
501 DROP TABLE IF EXISTS `security_fund`;
502 /*!40101 SET @saved_cs_client     = @@character_set_client */;
503 /*!40101 SET character_set_client = utf8 */;
504 CREATE TABLE `security_fund` (
505   `id` int(11) NOT NULL AUTO_INCREMENT,
506   `id_security` int(11) NOT NULL,
507   `type` int(11) NOT NULL DEFAULT '0',
508   `currency` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
509   `tranche` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
510   `date_inception` bigint(20) NOT NULL DEFAULT '0',
511   `date_fiscalyearend` bigint(20) NOT NULL DEFAULT '0',
512   `investment_minimum` int(11) NOT NULL DEFAULT '0',
513   `is_synthetic` tinyint(1) DEFAULT '0',
514   `distribution` float NOT NULL DEFAULT '0',
515   `distribution_interval` int(11) NOT NULL DEFAULT '12',
516   `date_distribution` bigint(20) NOT NULL DEFAULT '0',
517   `is_retaining_profits` tinyint(1) DEFAULT '0',
518   `redemption_period` int(11) NOT NULL DEFAULT '5',
519   `redemption_fee` float DEFAULT '0',
520   `issue_surcharge` float NOT NULL DEFAULT '0',
521   `management_fee` float NOT NULL DEFAULT '0',
522   `comment` text COLLATE utf8_unicode_ci,
523   PRIMARY KEY (`id`)
524 ) ENGINE=InnoDB AUTO_INCREMENT=101 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
525 /*!40101 SET character_set_client = @saved_cs_client */;
528 -- Table structure for table `security_quotesource`
531 DROP TABLE IF EXISTS `security_quotesource`;
532 /*!40101 SET @saved_cs_client     = @@character_set_client */;
533 /*!40101 SET character_set_client = utf8 */;
534 CREATE TABLE `security_quotesource` (
535   `id` int(11) NOT NULL AUTO_INCREMENT,
536   `source` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
537   PRIMARY KEY (`id`)
538 ) ENGINE=InnoDB AUTO_INCREMENT=53 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
539 /*!40101 SET character_set_client = @saved_cs_client */;
542 -- Table structure for table `security_stock`
545 DROP TABLE IF EXISTS `security_stock`;
546 /*!40101 SET @saved_cs_client     = @@character_set_client */;
547 /*!40101 SET character_set_client = utf8 */;
548 CREATE TABLE `security_stock` (
549   `id` int(11) NOT NULL AUTO_INCREMENT,
550   `id_security` int(11) NOT NULL,
551   `type` int(11) NOT NULL DEFAULT '0',
552   `dividend` float NOT NULL DEFAULT '0',
553   `dividend_interval` int(11) NOT NULL DEFAULT '12',
554   `dividend_exdate` bigint(20) NOT NULL DEFAULT '0',
555   `comment` text COLLATE utf8_unicode_ci,
556   PRIMARY KEY (`id`)
557 ) ENGINE=InnoDB AUTO_INCREMENT=16 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
558 /*!40101 SET character_set_client = @saved_cs_client */;
561 -- Table structure for table `security_symbolextension`
564 DROP TABLE IF EXISTS `security_symbolextension`;
565 /*!40101 SET @saved_cs_client     = @@character_set_client */;
566 /*!40101 SET character_set_client = utf8 */;
567 CREATE TABLE `security_symbolextension` (
568   `id` int(11) NOT NULL AUTO_INCREMENT,
569   `extension` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
570   `fullname` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
571   PRIMARY KEY (`id`)
572 ) ENGINE=InnoDB AUTO_INCREMENT=12 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
573 /*!40101 SET character_set_client = @saved_cs_client */;
576 -- Table structure for table `setting`
579 DROP TABLE IF EXISTS `setting`;
580 /*!40101 SET @saved_cs_client     = @@character_set_client */;
581 /*!40101 SET character_set_client = utf8 */;
582 CREATE TABLE `setting` (
583   `id` int(11) NOT NULL AUTO_INCREMENT,
584   `id_user` int(11) NOT NULL DEFAULT '0',
585   `type` varchar(10) COLLATE utf8_unicode_ci NOT NULL DEFAULT 'plugin',
586   `name` varchar(32) COLLATE utf8_unicode_ci DEFAULT NULL,
587   `var` varchar(32) COLLATE utf8_unicode_ci DEFAULT NULL,
588   `value` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
589   PRIMARY KEY (`id`)
590 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
591 /*!40101 SET character_set_client = @saved_cs_client */;
594 -- Table structure for table `split`
597 DROP TABLE IF EXISTS `split`;
598 /*!40101 SET @saved_cs_client     = @@character_set_client */;
599 /*!40101 SET character_set_client = utf8 */;
600 CREATE TABLE `split` (
601   `id` int(11) NOT NULL AUTO_INCREMENT,
602   `id_security` int(11) NOT NULL,
603   `date` int(11) NOT NULL,
604   `ratio` varchar(11) COLLATE utf8_unicode_ci NOT NULL,
605   `comment` mediumtext COLLATE utf8_unicode_ci,
606   PRIMARY KEY (`id`),
607   UNIQUE KEY `SID` (`id_security`,`date`) USING BTREE
608 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
609 /*!40101 SET character_set_client = @saved_cs_client */;
612 -- Table structure for table `timetag`
615 DROP TABLE IF EXISTS `timetag`;
616 /*!40101 SET @saved_cs_client     = @@character_set_client */;
617 /*!40101 SET character_set_client = utf8 */;
618 CREATE TABLE `timetag` (
619   `id` int(11) NOT NULL AUTO_INCREMENT,
620   `id_user` int(11) NOT NULL,
621   `title` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
622   `description` text COLLATE utf8_unicode_ci NOT NULL,
623   `start` int(11) NOT NULL,
624   `end` int(11) NOT NULL,
625   PRIMARY KEY (`id`)
626 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
627 /*!40101 SET character_set_client = @saved_cs_client */;
630 -- Table structure for table `user`
633 DROP TABLE IF EXISTS `user`;
634 /*!40101 SET @saved_cs_client     = @@character_set_client */;
635 /*!40101 SET character_set_client = utf8 */;
636 CREATE TABLE `user` (
637   `id` int(11) NOT NULL AUTO_INCREMENT,
638   `login` varchar(10) COLLATE utf8_unicode_ci NOT NULL,
639   `is_admin` tinyint(1) NOT NULL DEFAULT '0',
640   `fullname` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
641   `email` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL,
642   `comment` mediumtext COLLATE utf8_unicode_ci,
643   `password_digest` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
644   `password_auth_token` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
645   `password_reset_token` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
646   `password_reset_sent` datetime DEFAULT NULL,
647   PRIMARY KEY (`id`)
648 ) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
649 /*!40101 SET character_set_client = @saved_cs_client */;
652 -- Table structure for table `user_session`
655 DROP TABLE IF EXISTS `user_session`;
656 /*!40101 SET @saved_cs_client     = @@character_set_client */;
657 /*!40101 SET character_set_client = utf8 */;
658 CREATE TABLE `user_session` (
659   `id` int(11) NOT NULL AUTO_INCREMENT,
660   `session_id` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
661   `data` text COLLATE utf8_unicode_ci,
662   `created_at` datetime DEFAULT NULL,
663   `updated_at` datetime DEFAULT NULL,
664   PRIMARY KEY (`id`),
665   UNIQUE KEY `index_user_session_on_session_id` (`session_id`) USING BTREE,
666   KEY `index_user_session_on_updated_at` (`updated_at`) USING BTREE
667 ) ENGINE=InnoDB AUTO_INCREMENT=22 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
668 /*!40101 SET character_set_client = @saved_cs_client */;
671 -- Table structure for table `version`
674 DROP TABLE IF EXISTS `version`;
675 /*!40101 SET @saved_cs_client     = @@character_set_client */;
676 /*!40101 SET character_set_client = utf8 */;
677 CREATE TABLE `version` (
678   `version` tinyint(4) DEFAULT NULL
679 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
680 /*!40101 SET character_set_client = @saved_cs_client */;
681 /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
683 /*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
684 /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
685 /*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
686 /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
687 /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
688 /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
689 /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
691 -- Dump completed on 2015-06-18 14:02:14
692 INSERT INTO schema_migrations (version) VALUES ('20121205175542');
694 INSERT INTO schema_migrations (version) VALUES ('20140614211945');
696 INSERT INTO schema_migrations (version) VALUES ('20140726211355');
698 INSERT INTO schema_migrations (version) VALUES ('20140729185743');
700 INSERT INTO schema_migrations (version) VALUES ('20140813095312');
702 INSERT INTO schema_migrations (version) VALUES ('20141019170215');
704 INSERT INTO schema_migrations (version) VALUES ('20150211200338');
706 INSERT INTO schema_migrations (version) VALUES ('20150327145107');
708 INSERT INTO schema_migrations (version) VALUES ('20150328104427');
710 INSERT INTO schema_migrations (version) VALUES ('20150403195501');
712 INSERT INTO schema_migrations (version) VALUES ('20150425095545');
714 INSERT INTO schema_migrations (version) VALUES ('20150501152313');
716 INSERT INTO schema_migrations (version) VALUES ('20150525112839');
718 INSERT INTO schema_migrations (version) VALUES ('20150606173054');
720 INSERT INTO schema_migrations (version) VALUES ('20150610092844');
722 INSERT INTO schema_migrations (version) VALUES ('20150616152708');