Skip to content

Commit

Permalink
Merge branch 'refactor-contract' into staging
Browse files Browse the repository at this point in the history
  • Loading branch information
zmcNotafraid committed Nov 14, 2024
2 parents 0d23d64 + bc69f08 commit 6f196cb
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 8 deletions.
15 changes: 8 additions & 7 deletions app/models/contract.rb
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,12 @@ def self.query_script_ids(contracts)
#
# Indexes
#
# index_contracts_on_code_hash (code_hash)
# index_contracts_on_deprecated (deprecated)
# index_contracts_on_hash_type (hash_type)
# index_contracts_on_name (name)
# index_contracts_on_role (role)
# index_contracts_on_symbol (symbol)
# index_contracts_on_verified (verified)
# index_contracts_on_code_hash (code_hash)
# index_contracts_on_deployed_cell_output_id (deployed_cell_output_id) UNIQUE
# index_contracts_on_deprecated (deprecated)
# index_contracts_on_hash_type (hash_type)
# index_contracts_on_name (name)
# index_contracts_on_role (role)
# index_contracts_on_symbol (symbol)
# index_contracts_on_verified (verified)
#
5 changes: 5 additions & 0 deletions db/migrate/20241114074433_add_unique_index_to_contracts.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class AddUniqueIndexToContracts < ActiveRecord::Migration[7.0]
def change
add_index :contracts, :deployed_cell_output_id, unique: true
end
end
10 changes: 9 additions & 1 deletion db/structure.sql
Original file line number Diff line number Diff line change
Expand Up @@ -5054,6 +5054,13 @@ CREATE UNIQUE INDEX index_cell_inputs_on_ckb_transaction_id_and_index ON public.
CREATE INDEX index_contracts_on_code_hash ON public.contracts USING btree (code_hash);


--
-- Name: index_contracts_on_deployed_cell_output_id; Type: INDEX; Schema: public; Owner: -
--

CREATE UNIQUE INDEX index_contracts_on_deployed_cell_output_id ON public.contracts USING btree (deployed_cell_output_id);


--
-- Name: index_contracts_on_deprecated; Type: INDEX; Schema: public; Owner: -
--
Expand Down Expand Up @@ -6417,6 +6424,7 @@ INSERT INTO "schema_migrations" (version) VALUES
('20241030023309');
('20241105070340'),
('20241105070619'),
('20241106062022');
('20241106062022'),
('20241114074433');


0 comments on commit 6f196cb

Please sign in to comment.