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

Bump follow-redirects from 1.15.3 to 1.15.6 in /examples/pg-proxy #3

Open
wants to merge 86 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
86 commits
Select commit Hold shift + click to select a range
443df39
created singlestore-core and singlestore driver
Rodriguespn Jul 23, 2024
57e0dc3
change 'json_array' to 'json_to_array'
Rodriguespn Jul 23, 2024
e10136e
add bson type
Rodriguespn Jul 23, 2024
6c177c9
Renamed mysql to singlestore in singlestore-core
drodrigues4 Jul 23, 2024
78bd04e
Merge pull request #2 from singlestore-labs/the-great-renaming
drodrigues4 Jul 23, 2024
7e1133f
test actions
drodrigues4 Jul 23, 2024
f7f75e4
add uuid column
mitchwadair Jul 23, 2024
ce7c09e
add guid
mitchwadair Jul 23, 2024
783fc76
add override tag to `build`
mitchwadair Jul 23, 2024
dd8b12a
more actions tests
drodrigues4 Jul 23, 2024
21529bb
release to github
drodrigues4 Jul 23, 2024
2783479
add vector data type, operator experessions
mitchwadair Jul 23, 2024
5bce7e5
nits
drodrigues4 Jul 23, 2024
f7068dc
nits
drodrigues4 Jul 23, 2024
ab00e2a
add geographypoint type
mitchwadair Jul 23, 2024
0c14e0f
Push to NPM instead
drodrigues4 Jul 23, 2024
da0f7e4
Corrected version
drodrigues4 Jul 24, 2024
23aa8d2
Removed foreign keys
drodrigues4 Jul 24, 2024
d4e4045
Disallow INTERSECT ALL and EXCEPT ALL; Allow MINUS
drodrigues4 Jul 24, 2024
1ed0d80
Removed more stuff of foreign keys
drodrigues4 Jul 24, 2024
2903d1a
Build fork when pushing to main
drodrigues4 Jul 24, 2024
2df9688
Changed name of version var
drodrigues4 Jul 24, 2024
4b186e6
fixed action
drodrigues4 Jul 24, 2024
b42d3cb
Added detach
drodrigues4 Jul 24, 2024
da7e81f
Renamed driver
drodrigues4 Jul 24, 2024
f662fb4
Fixed detach
drodrigues4 Jul 24, 2024
4a15249
Added attach
drodrigues4 Jul 24, 2024
b9dccbe
Differentiate rowstore and columnstore on creation and block btree in…
tiagoacastro Jul 24, 2024
00ee412
Formatted files
tiagoacastro Jul 24, 2024
92268c1
Make index types difference clearer
tiagoacastro Jul 24, 2024
c88a60a
Apparently ATTACH does not support prepared statements, so we give th…
drodrigues4 Jul 24, 2024
b6a7853
Added ATTACH AT TIME
drodrigues4 Jul 24, 2024
6a73e72
Added ATTACH AS
drodrigues4 Jul 24, 2024
94df1b3
Trying another approach for type checking index input
tiagoacastro Jul 24, 2024
fbf33ec
initial geography implementation
mitchwadair Jul 24, 2024
35abff0
Reverth all columnstore and rowstore work
tiagoacastro Jul 24, 2024
1cb055f
add types to index, fix? geography
mitchwadair Jul 24, 2024
7ec3901
fix polygon
mitchwadair Jul 24, 2024
9621d95
Remove check
tiagoacastro Jul 24, 2024
4cd60b7
improve geography type narrowing
mitchwadair Jul 24, 2024
a574989
error -> drizzleerror
mitchwadair Jul 24, 2024
3f844c4
add branching
mitchwadair Jul 24, 2024
feffcfd
CREATE and DROP MILESTONE
drodrigues4 Jul 24, 2024
01334cc
combine buildAttachQuery and buildBranchQuery
mitchwadair Jul 24, 2024
4afb283
OPTIMIZE TABLE
drodrigues4 Jul 24, 2024
d09afcc
nits to OPTIMIZE TABLE
drodrigues4 Jul 24, 2024
f11e571
more nits
drodrigues4 Jul 24, 2024
a72e61c
even more nits
drodrigues4 Jul 24, 2024
52963af
more nits to OPTIMIZE TABLE
drodrigues4 Jul 25, 2024
a623dce
stringify BSON column
Rodriguespn Jul 24, 2024
10aec33
new blob column type
Rodriguespn Jul 25, 2024
fba59c0
Try another approach for table type related typecheck
tiagoacastro Jul 25, 2024
fcddec0
Fixed build
tiagoacastro Jul 25, 2024
3b08870
Even more nits to OPTIMIZE TABLE
drodrigues4 Jul 25, 2024
73486a0
Revert table changes
tiagoacastro Jul 25, 2024
24097f8
Add defaultCurrentTimestamp and fsp to defaultNow
drodrigues4 Jul 25, 2024
43188c3
Separated tables into columnstore and rowstore
tiagoacastro Jul 25, 2024
5f86590
Fix build
tiagoacastro Jul 25, 2024
08b4c4d
Fix build v2
tiagoacastro Jul 25, 2024
b83f2b7
fix geography data type
mitchwadair Jul 25, 2024
021bf75
fix geography type v2
mitchwadair Jul 25, 2024
d1dbe61
lint/fmt
mitchwadair Jul 25, 2024
b8686fa
nits with datetime
drodrigues4 Jul 25, 2024
dd8ffbd
improve geography code readability
mitchwadair Jul 25, 2024
1d7e53b
lint/fmt datetime
mitchwadair Jul 25, 2024
ee18494
improve readability in geography mapToDriverValue
mitchwadair Jul 25, 2024
f2b7128
Undo changes to differentiate tables
tiagoacastro Jul 25, 2024
337ee34
Fix build
tiagoacastro Jul 25, 2024
ac24dc3
Fix datetime merge error
tiagoacastro Jul 25, 2024
404d420
fix polygon generator
mitchwadair Jul 25, 2024
bc86043
fix relational query?
mitchwadair Jul 25, 2024
46e8864
revert
mitchwadair Jul 25, 2024
9daf249
fixed revert of 46e88647cd19230ce6a07f6f780ba7645218c123
drodrigues4 Jul 25, 2024
893caa4
Fix relational queries for S2
drodrigues4 Jul 25, 2024
d13c2a3
stuff
drodrigues4 Jul 26, 2024
e201257
Full text
drodrigues4 Jul 26, 2024
89ebe11
nits with fulltext index
drodrigues4 Jul 26, 2024
b7e596f
MATCH AGAINST
drodrigues4 Jul 26, 2024
f0bf136
nits
drodrigues4 Jul 26, 2024
7068637
more nits
drodrigues4 Jul 26, 2024
80e0bb0
nits with MATCH AGAINST
drodrigues4 Jul 26, 2024
5d01131
nits of MATCH AGAINST
drodrigues4 Jul 26, 2024
2e846a6
Sort key
drodrigues4 Jul 27, 2024
d20e3ca
Fixed sortKey
drodrigues4 Jul 27, 2024
ba24167
fix lint issues and add lint:fix command
Rodriguespn Jul 28, 2024
0a56453
Bump follow-redirects from 1.15.3 to 1.15.6 in /examples/pg-proxy
dependabot[bot] Jul 28, 2024
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
178 changes: 178 additions & 0 deletions .github/workflows/release-fork-to-npm.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,178 @@
name: Release fork to NPM

on:
push:
branches:
- main
workflow_dispatch:

env:
PACKAGE_VERSION: 0.32.1-${{ github.sha }}

jobs:
release:
permissions: write-all
strategy:
fail-fast: false
matrix:
package:
- drizzle-orm
runs-on: ubuntu-20.04
services:
postgres-postgis:
image: postgis/postgis:16-3.4
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: drizzle
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 54322:5432
postgres-vector:
image: pgvector/pgvector:pg16
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: drizzle
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 54321:5432
postgres:
image: postgres:14
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: drizzle
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 55433:5432
mysql:
image: mysql:8
env:
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: drizzle
options: >-
--health-cmd "mysqladmin ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 33306:3306
steps:
- uses: actions/checkout@v4

- uses: actions/setup-node@v4
with:
node-version: '18.18'
registry-url: 'https://registry.npmjs.org'

- uses: pnpm/action-setup@v3
name: Install pnpm
id: pnpm-install
with:
version: latest
run_install: false

- name: Get pnpm store directory
id: pnpm-cache
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_OUTPUT

- uses: actions/cache@v4
name: Setup pnpm cache
with:
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-

- name: Install dependencies
run: pnpm install

- name: Generate prisma schemas
run: |
(
cd drizzle-orm
pnpm prisma generate --schema src/prisma/schema.prisma
)
(
cd integration-tests
pnpm prisma generate --schema tests/prisma/pg/schema.prisma
pnpm prisma generate --schema tests/prisma/mysql/schema.prisma
pnpm prisma generate --schema tests/prisma/sqlite/schema.prisma
)

- name: Build
working-directory: ${{ matrix.package }}
run: |
jq '.name="@drodrigues4/${{ matrix.package }}"' package.json --tab > tmp.$$.json && mv tmp.$$.json package.json
jq --arg version "$PACKAGE_VERSION" '.version=$version' package.json --tab > tmp.$$.json && mv tmp.$$.json package.json
jq 'del(.publishConfig.provenance)' package.json --tab > tmp.$$.json && mv tmp.$$.json package.json

pnpm build

- name: Run tests
if: 0
env:
PG_CONNECTION_STRING: postgres://postgres:postgres@localhost:55433/drizzle
PG_VECTOR_CONNECTION_STRING: postgres://postgres:postgres@localhost:54321/drizzle
PG_POSTGIS_CONNECTION_STRING: postgres://postgres:postgres@localhost:54322/drizzle
MYSQL_CONNECTION_STRING: mysql://root:root@localhost:33306/drizzle
PLANETSCALE_CONNECTION_STRING: ${{ secrets.PLANETSCALE_CONNECTION_STRING }}
NEON_CONNECTION_STRING: ${{ secrets.NEON_CONNECTION_STRING }}
TIDB_CONNECTION_STRING: ${{ secrets.TIDB_CONNECTION_STRING }}
XATA_API_KEY: ${{ secrets.XATA_API_KEY }}
XATA_BRANCH: ${{ secrets.XATA_BRANCH }}
LIBSQL_URL: file:local.db
run: |
if [[ "${{ matrix.package }}" == "drizzle-orm" ]]; then
pnpm test --filter ${{ matrix.package }} --filter integration-tests
else
pnpm test --filter ${{ matrix.package }}
fi

- name: Pack
working-directory: ${{ matrix.package }}
shell: bash
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_ACCESS_TOKEN }}
run: |
npm run pack

- name: Run @arethetypeswrong/cli
if: 0
working-directory: ${{ matrix.package }}
shell: bash
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_ACCESS_TOKEN }}
run: |
pnpm attw package.tgz

- name: Publish
working-directory: ${{ matrix.package }}
shell: bash
env:
NODE_AUTH_TOKEN: ${{ secrets.NODE_AUTH_TOKEN }}
run: |
echo "//registry.npmjs.org/:_authToken=${NODE_AUTH_TOKEN}" > .npmrc

echo "Publishing ${{ matrix.package }}@$PACKAGE_VERSION"
npm publish package.tgz --access public

echo "npm: \`+ ${{ matrix.package }}@$PACKAGE_VERSION\`" >> $GITHUB_STEP_SUMMARY

# Post release message to Discord
# curl -X POST -H "Content-Type: application/json" -d "{\"embeds\": [{\"title\": \"New \`${{ matrix.package }}\` release! 🎉\", \"url\": \"https://www.npmjs.com/package/${{ matrix.package }}\", \"color\": \"12907856\", \"fields\": [{\"name\": \"Tag\", \"value\": \"\`$tag\`\"}]}]}" ${{ secrets.DISCORD_RELEASE_WEBHOOK_URL }}
9 changes: 6 additions & 3 deletions drizzle-orm/src/column-builder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { entityKind } from '~/entity.ts';
import type { Column } from './column.ts';
import type { MySqlColumn } from './mysql-core/index.ts';
import type { ExtraConfigColumn, PgColumn, PgSequenceOptions } from './pg-core/index.ts';
import type { SingleStoreColumn } from './singlestore-core/index.ts';
import type { SQL } from './sql/sql.ts';
import type { SQLiteColumn } from './sqlite-core/index.ts';
import type { Simplify } from './utils.ts';
Expand All @@ -17,7 +18,7 @@ export type ColumnDataType =
| 'custom'
| 'buffer';

export type Dialect = 'pg' | 'mysql' | 'sqlite' | 'common';
export type Dialect = 'pg' | 'mysql' | 'sqlite' | 'singlestore' | 'common';

export type GeneratedStorageMode = 'virtual' | 'stored';

Expand Down Expand Up @@ -299,7 +300,8 @@ export type BuildColumn<
TTableName extends string,
TBuilder extends ColumnBuilderBase,
TDialect extends Dialect,
> = TDialect extends 'pg' ? PgColumn<MakeColumnConfig<TBuilder['_'], TTableName>>
> = TDialect extends 'singlestore' ? SingleStoreColumn<MakeColumnConfig<TBuilder['_'], TTableName>>
: TDialect extends 'pg' ? PgColumn<MakeColumnConfig<TBuilder['_'], TTableName>>
: TDialect extends 'mysql' ? MySqlColumn<MakeColumnConfig<TBuilder['_'], TTableName>>
: TDialect extends 'sqlite' ? SQLiteColumn<MakeColumnConfig<TBuilder['_'], TTableName>>
: TDialect extends 'common' ? Column<MakeColumnConfig<TBuilder['_'], TTableName>>
Expand Down Expand Up @@ -337,7 +339,8 @@ export type BuildExtraConfigColumns<
& {};

export type ChangeColumnTableName<TColumn extends Column, TAlias extends string, TDialect extends Dialect> =
TDialect extends 'pg' ? PgColumn<MakeColumnConfig<TColumn['_'], TAlias>>
TDialect extends 'singlestore' ? SingleStoreColumn<MakeColumnConfig<TColumn['_'], TAlias>>
: TDialect extends 'pg' ? PgColumn<MakeColumnConfig<TColumn['_'], TAlias>>
: TDialect extends 'mysql' ? MySqlColumn<MakeColumnConfig<TColumn['_'], TAlias>>
: TDialect extends 'sqlite' ? SQLiteColumn<MakeColumnConfig<TColumn['_'], TAlias>>
: never;
11 changes: 11 additions & 0 deletions drizzle-orm/src/singlestore-core/alias.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { TableAliasProxyHandler } from '~/alias.ts';
import type { BuildAliasTable } from './query-builders/select.types.ts';
import type { SingleStoreTable } from './table.ts';
import type { SingleStoreViewBase } from './view-base.ts';

export function alias<TTable extends SingleStoreTable | SingleStoreViewBase, TAlias extends string>(
table: TTable,
alias: TAlias,
): BuildAliasTable<TTable, TAlias> {
return new Proxy(table, new TableAliasProxyHandler(alias, false)) as any;
}
115 changes: 115 additions & 0 deletions drizzle-orm/src/singlestore-core/columns/bigint.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
import type { ColumnBuilderBaseConfig, ColumnBuilderRuntimeConfig, MakeColumnConfig } from '~/column-builder.ts';
import type { ColumnBaseConfig } from '~/column.ts';
import { entityKind } from '~/entity.ts';
import type { AnySingleStoreTable } from '~/singlestore-core/table.ts';
import { SingleStoreColumnBuilderWithAutoIncrement, SingleStoreColumnWithAutoIncrement } from './common.ts';

export type SingleStoreBigInt53BuilderInitial<TName extends string> = SingleStoreBigInt53Builder<{
name: TName;
dataType: 'number';
columnType: 'SingleStoreBigInt53';
data: number;
driverParam: number | string;
enumValues: undefined;
generated: undefined;
}>;

export class SingleStoreBigInt53Builder<T extends ColumnBuilderBaseConfig<'number', 'SingleStoreBigInt53'>>
extends SingleStoreColumnBuilderWithAutoIncrement<T, { unsigned: boolean }>
{
static readonly [entityKind]: string = 'SingleStoreBigInt53Builder';

constructor(name: T['name'], unsigned: boolean = false) {
super(name, 'number', 'SingleStoreBigInt53');
this.config.unsigned = unsigned;
}

/** @internal */
override build<TTableName extends string>(
table: AnySingleStoreTable<{ name: TTableName }>,
): SingleStoreBigInt53<MakeColumnConfig<T, TTableName>> {
return new SingleStoreBigInt53<MakeColumnConfig<T, TTableName>>(
table,
this.config as ColumnBuilderRuntimeConfig<any, any>,
);
}
}

export class SingleStoreBigInt53<T extends ColumnBaseConfig<'number', 'SingleStoreBigInt53'>>
extends SingleStoreColumnWithAutoIncrement<T, { unsigned: boolean }>
{
static readonly [entityKind]: string = 'SingleStoreBigInt53';

getSQLType(): string {
return `bigint${this.config.unsigned ? ' unsigned' : ''}`;
}

override mapFromDriverValue(value: number | string): number {
if (typeof value === 'number') {
return value;
}
return Number(value);
}
}

export type SingleStoreBigInt64BuilderInitial<TName extends string> = SingleStoreBigInt64Builder<{
name: TName;
dataType: 'bigint';
columnType: 'SingleStoreBigInt64';
data: bigint;
driverParam: string;
enumValues: undefined;
generated: undefined;
}>;

export class SingleStoreBigInt64Builder<T extends ColumnBuilderBaseConfig<'bigint', 'SingleStoreBigInt64'>>
extends SingleStoreColumnBuilderWithAutoIncrement<T, { unsigned: boolean }>
{
static readonly [entityKind]: string = 'SingleStoreBigInt64Builder';

constructor(name: T['name'], unsigned: boolean = false) {
super(name, 'bigint', 'SingleStoreBigInt64');
this.config.unsigned = unsigned;
}

/** @internal */
override build<TTableName extends string>(
table: AnySingleStoreTable<{ name: TTableName }>,
): SingleStoreBigInt64<MakeColumnConfig<T, TTableName>> {
return new SingleStoreBigInt64<MakeColumnConfig<T, TTableName>>(
table,
this.config as ColumnBuilderRuntimeConfig<any, any>,
);
}
}

export class SingleStoreBigInt64<T extends ColumnBaseConfig<'bigint', 'SingleStoreBigInt64'>>
extends SingleStoreColumnWithAutoIncrement<T, { unsigned: boolean }>
{
static readonly [entityKind]: string = 'SingleStoreBigInt64';

getSQLType(): string {
return `bigint${this.config.unsigned ? ' unsigned' : ''}`;
}

// eslint-disable-next-line unicorn/prefer-native-coercion-functions
override mapFromDriverValue(value: string): bigint {
return BigInt(value);
}
}

interface SingleStoreBigIntConfig<T extends 'number' | 'bigint' = 'number' | 'bigint'> {
mode: T;
unsigned?: boolean;
}

export function bigint<TName extends string, TMode extends SingleStoreBigIntConfig['mode']>(
name: TName,
config: SingleStoreBigIntConfig<TMode>,
): TMode extends 'number' ? SingleStoreBigInt53BuilderInitial<TName> : SingleStoreBigInt64BuilderInitial<TName>;
export function bigint(name: string, config: SingleStoreBigIntConfig) {
if (config.mode === 'number') {
return new SingleStoreBigInt53Builder(name, config.unsigned);
}
return new SingleStoreBigInt64Builder(name, config.unsigned);
}
Loading
Loading