Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: checker integration #53

Merged
merged 4 commits into from
Jan 15, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 11 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,31 +55,35 @@ cp .env.example .env
docker-compose up -d --build
```

3. Copy the Example Environment File on `apps/migration-scripts` and edit the `.env` file
3. Copy the Example Environment File on `scripts/migrations` and edit the `.env` file

```
cp apps/migration-scripts/.env.example apps/migration-scripts/.env
cp scripts/migrations/.env.example scripts/migrations/.env
```

4. After starting Docker Compose, run the following command to apply the database migrations:

```
pnpm script:db:migrate
pnpm db:migrate
```

5. Navigate to the processing service directory and start it with:
5. Copy the Example Environment File on `apps/processing` and edit the `.env` file

cp apps/processing/.env.example apps/processing/.env

6. Start the Processing service with:

```
cd apps/processing && pnpm dev
pnpm dev
```

Once the setup is completed you can access Hasura by navigating to:

```
http://localhost:8080/
http://localhost:8082/
```

Use the default password: `testing`.
Use the default password: `my-admin-secret`.

## Contributing

Expand Down
4 changes: 2 additions & 2 deletions apps/indexer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ COPY . /app
WORKDIR /app

RUN --mount=type=cache,id=pnpm,target=$PNPM_HOME/store pnpm install --frozen-lockfile
RUN pnpm dlx envio codegen
RUN pnpm envio codegen

CMD pnpm dlx envio local db-migrate up && pnpm dlx envio start
CMD pnpm envio local db-migrate up && pnpm envio start
3 changes: 2 additions & 1 deletion docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ services:
HASURA_GRAPHQL_UNAUTHORIZED_ROLE: ${DATALAYER_HASURA_UNAUTHORIZED_ROLE:-public}
HASURA_GRAPHQL_CORS_DOMAIN: ${DATALAYER_HASURA_CORS_DOMAIN:-*}
HASURA_GRAPHQL_ENABLE_TELEMETRY: ${DATALAYER_HASURA_ENABLE_TELEMETRY:-false}
HASURA_GRAPHQL_EXPERIMENTAL_FEATURES: "bigquery_string_numeric_input"
HASURA_GRAPHQL_EXPERIMENTAL_FEATURES: "bigquery_string_numeric_input,naming_convention"
HASURA_GRAPHQL_DEFAULT_NAMING_CONVENTION: "graphql-default"
HASURA_GRAPHQL_BIGQUERY_STRING_NUMERIC_INPUT: "true"
## enable debugging mode. It is recommended to disable this in production
HASURA_GRAPHQL_DEV_MODE: ${DATALAYER_HASURA_DEV_MODE:-true}
Expand Down
23 changes: 22 additions & 1 deletion scripts/migrations/src/migrations/20241029T120000_initial.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Kysely, sql } from "kysely";
import { Kysely, RawBuilder, sql } from "kysely";

import { getSchemaName } from "../utils/index.js";

Expand All @@ -16,6 +16,7 @@ export async function up(db: Kysely<any>): Promise<void> {
const CURRENCY_TYPE = sql`numeric(18,2)`;

const schema = getSchemaName(db.schema);
const ref = (name: string): RawBuilder<unknown> => sql.table(`${schema}.${name}`);
await db.schema.createType("project_type").asEnum(["canonical", "linked"]).execute();

console.log("schema", schema);
Expand Down Expand Up @@ -206,6 +207,14 @@ export async function up(db: Kysely<any>): Promise<void> {
.addColumn("tags", sql`text[]`)

.addPrimaryKeyConstraint("applications_pkey", ["chainId", "roundId", "id"])
.addForeignKeyConstraint(
"applications_projects_fkey",
["chainId", "projectId"],
"projects",
["chainId", "id"],
(cb) => cb.onDelete("cascade"),
)

.addForeignKeyConstraint(
"applications_rounds_fkey",
["roundId", "chainId"],
Expand Down Expand Up @@ -288,6 +297,18 @@ export async function up(db: Kysely<any>): Promise<void> {
.addUniqueConstraint("unique_v1ProjectId", ["v1ProjectId"])
.addUniqueConstraint("unique_v2ProjectId", ["v2ProjectId"])
.execute();

// Project search function
await sql`

create function ${ref("search_projects")}(search_term text)
returns setof ${ref("projects")} as $$
select *
from ${ref("projects")}
where to_tsvector(name) @@ to_tsquery(search_term)
order by ts_rank_cd(to_tsvector(name), to_tsquery(search_term)) desc;
$$ language sql stable;
`.execute(db);
}

// eslint-disable-next-line @typescript-eslint/no-explicit-any
Expand Down
Loading