From 3bdb9b5beb6e240155690f556db606b420ba2baa Mon Sep 17 00:00:00 2001 From: Ariel Mashraki Date: Tue, 24 Sep 2024 11:55:38 +0300 Subject: [PATCH] sql/postgres: reduce usage of stubs and separate oss/ent builds --- sql/postgres/diff_oss.go | 5 +++++ sql/postgres/{sqlspec.go => sqlspec_oss.go} | 2 ++ sql/postgres/{sqlspec_test.go => sqlspec_oss_test.go} | 2 ++ 3 files changed, 9 insertions(+) rename sql/postgres/{sqlspec.go => sqlspec_oss.go} (99%) rename sql/postgres/{sqlspec_test.go => sqlspec_oss_test.go} (99%) diff --git a/sql/postgres/diff_oss.go b/sql/postgres/diff_oss.go index 38900c4cce7..70c49944476 100644 --- a/sql/postgres/diff_oss.go +++ b/sql/postgres/diff_oss.go @@ -270,6 +270,11 @@ func (*diff) ReferenceChanged(from, to schema.ReferenceOption) bool { return from != to } +// ForeignKeyAttrChanged reports if any of the foreign-key attributes were changed. +func (*diff) ForeignKeyAttrChanged(_, _ []schema.Attr) bool { + return false +} + // DiffOptions defines PostgreSQL specific schema diffing process. type DiffOptions struct { ConcurrentIndex struct { diff --git a/sql/postgres/sqlspec.go b/sql/postgres/sqlspec_oss.go similarity index 99% rename from sql/postgres/sqlspec.go rename to sql/postgres/sqlspec_oss.go index b537272b33c..ed55dda5db1 100644 --- a/sql/postgres/sqlspec.go +++ b/sql/postgres/sqlspec_oss.go @@ -2,6 +2,8 @@ // This source code is licensed under the Apache 2.0 license found // in the LICENSE file in the root directory of this source tree. +//go:build !ent + package postgres import ( diff --git a/sql/postgres/sqlspec_test.go b/sql/postgres/sqlspec_oss_test.go similarity index 99% rename from sql/postgres/sqlspec_test.go rename to sql/postgres/sqlspec_oss_test.go index cb1923d548e..4cdcfe7f842 100644 --- a/sql/postgres/sqlspec_test.go +++ b/sql/postgres/sqlspec_oss_test.go @@ -2,6 +2,8 @@ // This source code is licensed under the Apache 2.0 license found // in the LICENSE file in the root directory of this source tree. +//go:build !ent + package postgres import (