Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
N
nebula
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
exchain
nebula
Commits
8c8e4340
Unverified
Commit
8c8e4340
authored
Oct 06, 2023
by
Hamdi Allam
Committed by
GitHub
Oct 06, 2023
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #7586 from ethereum-optimism/indexer.uin256.domain
bugfix(indexer) uint256 sql domain check constraint
parents
44d5f41a
21edee84
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
1 deletion
+6
-1
20230523_create_schema.sql
indexer/migrations/20230523_create_schema.sql
+6
-1
No files found.
indexer/migrations/20230523_create_schema.sql
View file @
8c8e4340
...
@@ -3,7 +3,12 @@ DO $$
...
@@ -3,7 +3,12 @@ DO $$
BEGIN
BEGIN
IF
NOT
EXISTS
(
SELECT
1
FROM
pg_type
WHERE
typname
=
'uint256'
)
THEN
IF
NOT
EXISTS
(
SELECT
1
FROM
pg_type
WHERE
typname
=
'uint256'
)
THEN
CREATE
DOMAIN
UINT256
AS
NUMERIC
CREATE
DOMAIN
UINT256
AS
NUMERIC
CHECK
(
VALUE
>=
0
AND
VALUE
<
2
^
256
and
SCALE
(
VALUE
)
=
0
);
CHECK
(
VALUE
>=
0
AND
VALUE
<
POWER
(
CAST
(
2
AS
NUMERIC
),
CAST
(
256
AS
NUMERIC
))
AND
SCALE
(
VALUE
)
=
0
);
ELSE
-- To remain backwards compatible, drop the old constraint and re-add.
ALTER
DOMAIN
UINT256
DROP
CONSTRAINT
uint256_check
;
ALTER
DOMAIN
UINT256
ADD
CHECK
(
VALUE
>=
0
AND
VALUE
<
POWER
(
CAST
(
2
AS
NUMERIC
),
CAST
(
256
AS
NUMERIC
))
AND
SCALE
(
VALUE
)
=
0
);
END
IF
;
END
IF
;
END
$$
;
END
$$
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment