nomad

HCL and Docker files for Nomad deployments
git clone https://git.in0rdr.ch/nomad.git
Log | Files | Refs | Pull requests |Archive

schema.sql.tmpl (6970B)


      1 --
      2 -- Database: `writefreely`
      3 --
      4 
      5 -- --------------------------------------------------------
      6 
      7 --
      8 -- Table structure for table `accesstokens`
      9 --
     10 
     11 CREATE TABLE IF NOT EXISTS `accesstokens` (
     12   `token` binary(16) NOT NULL,
     13   `user_id` int(6) NOT NULL,
     14   `sudo` tinyint(1) NOT NULL DEFAULT '0',
     15   `one_time` tinyint(1) NOT NULL DEFAULT '0',
     16   `created` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
     17   `expires` datetime DEFAULT NULL,
     18   `user_agent` varchar(255) DEFAULT NULL,
     19   PRIMARY KEY (`token`)
     20 ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
     21 
     22 -- --------------------------------------------------------
     23 
     24 --
     25 -- Table structure for table `appcontent`
     26 --
     27 
     28 CREATE TABLE IF NOT EXISTS `appcontent` (
     29   `id` varchar(36) NOT NULL,
     30   `content` mediumtext CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
     31   `updated` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
     32   PRIMARY KEY (`id`)
     33 ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
     34 
     35 -- --------------------------------------------------------
     36 
     37 --
     38 -- Table structure for table `appmigrations`
     39 --
     40 
     41 CREATE TABLE IF NOT EXISTS `appmigrations` (
     42   `version` int(11) NOT NULL,
     43   `migrated` datetime NOT NULL,
     44   `result` text NOT NULL
     45 ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
     46 
     47 -- --------------------------------------------------------
     48 
     49 --
     50 -- Table structure for table `collectionattributes`
     51 --
     52 
     53 CREATE TABLE IF NOT EXISTS `collectionattributes` (
     54   `collection_id` int(6) NOT NULL,
     55   `attribute` varchar(128) NOT NULL,
     56   `value` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL,
     57   PRIMARY KEY (`collection_id`,`attribute`)
     58 ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
     59 
     60 -- --------------------------------------------------------
     61 
     62 --
     63 -- Table structure for table `collectionkeys`
     64 --
     65 
     66 CREATE TABLE IF NOT EXISTS `collectionkeys` (
     67   `collection_id` int(6) NOT NULL,
     68   `public_key` blob NOT NULL,
     69   `private_key` blob NOT NULL,
     70   PRIMARY KEY (`collection_id`)
     71 ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
     72 
     73 -- --------------------------------------------------------
     74 
     75 --
     76 -- Table structure for table `collectionpasswords`
     77 --
     78 
     79 CREATE TABLE IF NOT EXISTS `collectionpasswords` (
     80   `collection_id` int(6) NOT NULL,
     81   `password` char(60) NOT NULL,
     82   PRIMARY KEY (`collection_id`)
     83 ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
     84 
     85 -- --------------------------------------------------------
     86 
     87 --
     88 -- Table structure for table `collectionredirects`
     89 --
     90 
     91 CREATE TABLE IF NOT EXISTS `collectionredirects` (
     92   `prev_alias` varchar(100) NOT NULL,
     93   `new_alias` varchar(100) NOT NULL,
     94   PRIMARY KEY (`prev_alias`)
     95 ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
     96 
     97 -- --------------------------------------------------------
     98 
     99 --
    100 -- Table structure for table `collections`
    101 --
    102 
    103 CREATE TABLE IF NOT EXISTS `collections` (
    104   `id` int(6) NOT NULL AUTO_INCREMENT,
    105   `alias` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL,
    106   `title` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL,
    107   `description` varchar(160) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL,
    108   `style_sheet` text,
    109   `script` text CHARACTER SET utf8mb4 COLLATE utf8mb4_bin,
    110   `format` varchar(8) DEFAULT NULL,
    111   `privacy` tinyint(1) NOT NULL,
    112   `owner_id` int(6) NOT NULL,
    113   `view_count` int(6) NOT NULL,
    114   PRIMARY KEY (`id`),
    115   UNIQUE KEY `alias` (`alias`)
    116 ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
    117 
    118 -- --------------------------------------------------------
    119 
    120 --
    121 -- Table structure for table `posts`
    122 --
    123 
    124 CREATE TABLE IF NOT EXISTS `posts` (
    125   `id` char(16) NOT NULL,
    126   `slug` varchar(100) DEFAULT NULL,
    127   `modify_token` char(32) DEFAULT NULL,
    128   `text_appearance` char(4) NOT NULL DEFAULT 'norm',
    129   `language` char(2) DEFAULT NULL,
    130   `rtl` tinyint(1) DEFAULT NULL,
    131   `privacy` tinyint(1) NOT NULL,
    132   `owner_id` int(6) DEFAULT NULL,
    133   `collection_id` int(6) DEFAULT NULL,
    134   `pinned_position` tinyint(1) UNSIGNED DEFAULT NULL,
    135   `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
    136   `updated` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
    137   `view_count` int(6) NOT NULL,
    138   `title` varchar(160) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL,
    139   `content` text CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL,
    140   PRIMARY KEY (`id`),
    141   UNIQUE KEY `id_slug` (`collection_id`,`slug`),
    142   UNIQUE KEY `owner_id` (`owner_id`,`id`),
    143   KEY `privacy_id` (`privacy`,`id`)
    144 ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
    145 
    146 -- --------------------------------------------------------
    147 
    148 --
    149 -- Table structure for table `remotefollows`
    150 --
    151 
    152 CREATE TABLE IF NOT EXISTS `remotefollows` (
    153   `collection_id` int(11) NOT NULL,
    154   `remote_user_id` int(11) NOT NULL,
    155   `created` datetime NOT NULL,
    156   PRIMARY KEY (`collection_id`,`remote_user_id`)
    157 ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
    158 
    159 -- --------------------------------------------------------
    160 
    161 --
    162 -- Table structure for table `remoteuserkeys`
    163 --
    164 
    165 CREATE TABLE IF NOT EXISTS `remoteuserkeys` (
    166   `id` varchar(255) NOT NULL,
    167   `remote_user_id` int(11) NOT NULL,
    168   `public_key` blob NOT NULL,
    169   PRIMARY KEY (`id`),
    170   UNIQUE KEY `follower_id` (`remote_user_id`)
    171 ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
    172 
    173 -- --------------------------------------------------------
    174 
    175 --
    176 -- Table structure for table `remoteusers`
    177 --
    178 
    179 CREATE TABLE IF NOT EXISTS `remoteusers` (
    180   `id` int(11) NOT NULL AUTO_INCREMENT,
    181   `actor_id` varchar(255) NOT NULL,
    182   `inbox` varchar(255) NOT NULL,
    183   `shared_inbox` varchar(255) NOT NULL,
    184   PRIMARY KEY (`id`),
    185   UNIQUE KEY `collection_id` (`actor_id`)
    186 ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
    187 
    188 -- --------------------------------------------------------
    189 
    190 --
    191 -- Table structure for table `userattributes`
    192 --
    193 
    194 CREATE TABLE IF NOT EXISTS `userattributes` (
    195   `user_id` int(6) NOT NULL,
    196   `attribute` varchar(64) NOT NULL,
    197   `value` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL,
    198   PRIMARY KEY (`user_id`,`attribute`)
    199 ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
    200 
    201 -- --------------------------------------------------------
    202 
    203 --
    204 -- Table structure for table `userinvites`
    205 --
    206 
    207 CREATE TABLE IF NOT EXISTS `userinvites` (
    208   `id` char(6) NOT NULL,
    209   `owner_id` int(11) NOT NULL,
    210   `max_uses` smallint(6) DEFAULT NULL,
    211   `created` datetime NOT NULL,
    212   `expires` datetime DEFAULT NULL,
    213   `inactive` tinyint(1) NOT NULL
    214 ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
    215 
    216 -- --------------------------------------------------------
    217 
    218 --
    219 -- Table structure for table `users`
    220 --
    221 
    222 CREATE TABLE IF NOT EXISTS `users` (
    223   `id` int(6) NOT NULL AUTO_INCREMENT,
    224   `username` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL,
    225   `password` char(60) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL,
    226   `email` varbinary(255) DEFAULT NULL,
    227   `created` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
    228   PRIMARY KEY (`id`),
    229   UNIQUE KEY `username` (`username`)
    230 ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
    231 
    232 -- --------------------------------------------------------
    233 
    234 --
    235 -- Table structure for table `usersinvited`
    236 --
    237 
    238 CREATE TABLE IF NOT EXISTS `usersinvited` (
    239   `invite_id` char(6) NOT NULL,
    240   `user_id` int(11) NOT NULL
    241 ) ENGINE=InnoDB DEFAULT CHARSET=latin1;