This repository was archived by the owner on Sep 25, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscripture.install
More file actions
162 lines (158 loc) · 5.12 KB
/
scripture.install
File metadata and controls
162 lines (158 loc) · 5.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
<?php
/*
* DATABASE SCHEMA
* https://api.drupal.org/api/drupal/includes!database!schema.inc/group/schemaapi/7
*/
/**
* Implements hook_schema()
* https://api.drupal.org/api/drupal/modules!system!system.api.php/function/hook_schema/7
*/
function scripture_schema() {
/*
* NB: This hook ... cannot rely on the .module file being loaded or hooks being known
*
* Development: Use the devel module or drush to quickly uninstall and re-install the
* module, thereby dropping and re-creating the database tables defined here. To update
* the database without losing information (between stable version releases), read this
* https://api.drupal.org/api/drupal/modules%21system%21system.api.php/function/hook_update_N/7
* and follow this guide: http://rapiddg.com/blog-post/updating-drupal-modules-schema
*/
return array(
'lw_translations' => array(
'description' => 'Bible translations',
'fields' => array(
'abbr' => array(
'description' => 'Translation abbreviation, e.g. "esv", "aov"',
'type' => 'varchar',
'not null' => true,
'length' => 8,
),
'name' => array(
'description' => 'Full name of the translation, e.g. “English Standard Version”',
'type' => 'varchar',
'not null' => true,
'length' => 100,
),
'lang' => array(
'description' => 'The drupal language code which this translation corresponds to',
'type' => 'varchar',
'not null' => true,
'default' => 'und',
'length' => 12,
),
),
'primary key' => array('abbr'),
),
'lw_verses' => array(
'description' => 'Bible verses',
'fields' => array(
'vid' => array(
'description' => 'verse ID; unique within translation; all verses with this ID has the same textual content, but in different translations',
'type' => 'int',
'not null' => true,
'unsigned' => true,
),
'translation' => array(
'description' => 'Bible translation this verse originates from',
'type' => 'varchar',
'length' => '8',
'not null' => true,
),
'booknum' => array(
'description' => 'Position of bible book in the translation (1-66)',
'type' => 'int',
'size' => 'tiny',
'not null' => true,
'unsigned' => true,
),
'chapternum' => array(
'description' => 'Position of chapter in book (1-150)',
'type' => 'int',
'size' => 'tiny',
'not null' => true,
'unsigned' => true,
),
'versenum' => array(
'description' => 'Position of verse in chapter (1-176)',
'type' => 'varchar',
'length' => '8',
'not null' => true,
),
'versetext' => array(
'description' => 'Content of the verse',
'type' => 'text',
// collation is utf8_general_ci by default
),
),
'primary key' => array('booknum','chapternum','versenum','translation'),
'unique keys' => array(
'vid_translation_unique' => array('vid','translation'),
),
'foreign keys' => array(
'in_translation' => array(
'table' => 'lw_translations',
'columns' => array('translation'=>'abbr'),
),
'in_book' => array(
'table' => 'lw_books',
'columns' => array('translation'=>'abbr',
'booknum'=>'booknum'),
),
),
),
'lw_books' => array(
'description' => 'Bible books and their names',
'fields' => array(
'booknum' => array(
'description' => 'Position of bible book in the translation (1-66)',
'type' => 'int',
'size' => 'tiny',
'not null' => true,
'unsigned' => true,
),
'translation' => array(
'description' => 'Bible translation this book is in',
'type' => 'varchar',
'length' => '8',
'not null' => true,
),
'bookname' => array(
'description' => 'What this book is called in the specific translation',
'type' => 'varchar',
'not null' => true,
'length' => 200,
// collation is utf8_general_ci by default
),
),
'primary key' => array('booknum','translation'),
'foreign keys' => array(
'ref_translation' => array(
'table' => 'lw_translations',
'columns' => array('translation'=>'abbr'),
),
),
),
);
}
/**
* Implements hook_field_schema($field).
* https://api.drupal.org/api/drupal/modules!field!field.api.php/function/hook_field_schema/7
*/
function scripture_field_schema($field) {
return array(
'columns' => array(
'from_vid' => array(
'description' => 'Start of range of verses',
'type' => 'int',
'not-null' => true,
'unsigned' => true,
),
'to_vid' => array(
'description' => 'End of range of verses',
'type' => 'int',
'not-null' => true,
'unsigned' => true,
),
),
);
}