summaryrefslogtreecommitdiff
path: root/migrations/20240929013644_token_id.sql
blob: ad4d8b498e9377ea6c0f13540a86d9e60cefb639 (plain)
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
alter table token
rename to old_token;

create table token (
	id text
		not null
		primary key,
	secret text
		not null
		unique,
	login text
		not null,
	issued_at text
		not null,
	last_used_at text
		not null,
	foreign key (login)
		references login (id)
);

insert into token
select
	'T' || lower(hex(randomblob(8))) as id,
	*
from old_token;

drop table old_token;

create index token_issued_at on token (issued_at);