-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSqlCreateStatementToAhaWikiFormat.html
More file actions
148 lines (124 loc) · 3.5 KB
/
SqlCreateStatementToAhaWikiFormat.html
File metadata and controls
148 lines (124 loc) · 3.5 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
<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>SqlCreateStatementToAhaWikiFormat</title>
<link rel="stylesheet" href="less.css">
<script type="text/javascript" src="//cdn.jsdelivr.net/json2/0.2/json2.js"></script>
<script type="text/javascript" src="//cdn.jsdelivr.net/jquery/1.11.0/jquery.min.js"></script>
<script type="text/javascript" src="polyfill.js"></script>
<script type="text/javascript">
$(function(){
$('.src').keyup(function () {
var val = $(this).val();
var result = val
.replace(/\n\t\t/g, " ")
.split('\n')
.map(function (l) {
return l
.replace(/^create table /i, '== ')
.replace(/^\(/, '[[[#!AhaTracTable tsv 1\nLogical Name\tPhysical Name\tType\tConstraints')
.replace(/^\);?$/, ']]]')
.replace(/^\t(\S+)\s+(\S+)\s+(.+?)/, '$1\t$2\t$3')
.replace(/,$/, '');
}).map(function(l) {
if(l.match(/comment '([^']*)'/)) {
return l.replace(/^(.+)(comment '([^']*))'(.*)$/i, '$3\t$1 $4')
} else if(l.match(/^\w/)) {
return '\t' + l;
} else {
return l;
}
})
.join('\n')
.replace(/== (\w+)(.+?)\ncomment '([^']*)';/sg, '== $1 - $3$2');
$('.dst').val(result);
}).keyup();
});
</script>
</head>
<body class="SqlCreateStatementToAhaWikiFormat">
<div class="wrap">
<h1>nativebinary - SqlCreateStatementToAhaWikiFormat</h1>
<table style="height: 100%; width: 100%;">
<tr>
<td width="50%">
<textarea class="src">
create table Link
(
src varchar(255) not null comment '시작',
dst varchar(255) not null comment '대상',
alias varchar(255) null comment '별명',
primary key (src, dst)
)
comment '링크';
create table Page
(
name varchar(255) not null,
revision int not null,
time bigint null,
author text null,
remoteAddress text null,
content longtext null,
comment text null,
primary key (name, revision)
);
create table CosineSimilarity
(
name1 varchar(255) not null,
name2 varchar(255) not null,
similarity double null,
primary key (name1, name2),
constraint fkCosineSimilarityName1
foreign key (name1) references Page (name),
constraint fkCosineSimilarityName2
foreign key (name2) references Page (name)
);
create table TermFrequency
(
name varchar(255) not null,
term varchar(255) not null,
frequency int null,
primary key (name, term),
constraint fkTermFrequencyName
foreign key (name) references Page (name)
);
create table play_evolutions
(
id int not null
primary key,
hash varchar(255) not null,
applied_at timestamp default CURRENT_TIMESTAMP not null,
apply_script mediumtext null,
revert_script mediumtext null,
state varchar(255) null,
last_problem mediumtext null
);
create table wiki
(
name varchar(255) not null,
version int not null,
time bigint null,
author text null,
ipnr text null,
text longtext null,
comment text null,
readonly int null,
constraint sqlite_autoindex_wiki_1
unique (name, version)
);
create index wiki_time_idx
on wiki (time);
alter table wiki
add primary key (name, version);
</textarea>
</td>
<td width="50%">
<textarea class="dst"></textarea>
</td>
</tr>
</table>
</div>
</body>
</html>