Giter Club home page Giter Club logo

Comments (5)

rafalkasa avatar rafalkasa commented on May 26, 2024

@kjvalencik thank you for create the issue. I'm start investigating what is the reason of this exception...
This will be fixed as soon as possible!

from schemaspy.

kjvalencik avatar kjvalencik commented on May 26, 2024

@rafalkasa Thanks for getting back so quickly. I put together a minimal repro script. Let me know if there is anything else I can provide.

SQL to generate a cross schema FK.

CREATE SCHEMA a
GO
CREATE SCHEMA b
GO

CREATE TABLE a.tbl_a (c int, PRIMARY KEY (c))
GO
CREATE TABLE b.tbl_b (c int, PRIMARY KEY (c), FOREIGN KEY (c) REFERENCES a.tbl_a(c))
GO

Full script to reproduce.

#!/bin/bash

set -euo pipefail

name="mssql-schemaspy"
password="Passw0rd"

function clean_up {
	docker rm -f "$name"  > /dev/null 2>&1 || true
}

trap clean_up EXIT

function start_sql {
docker run -d \
		--name="$name" \
		-e ACCEPT_EULA="Y" \
		-e SA_PASSWORD="$password" \
	microsoft/mssql-server-linux:latest \
		> /dev/null
}

function exec_sql {
	docker run -i --rm \
			--net="container:${name}" \
			--entrypoint="sqlcmd" \
		tsgkadot/mssql-tools:latest \
			-d "${1-test}" -S 127.0.0.1 -U sa -P "$password"
}

function wait_for_sql {
	until is_ready > /dev/null; do
		sleep 1
	done
}

function is_ready {
	exec_sql master << EOF
SELECT state
FROM master.sys.databases
GO
EOF
}

function create_db {
	exec_sql master << EOF
CREATE DATABASE test
GO
EOF
}

function create_schemas {
	exec_sql << EOF
CREATE SCHEMA a
GO
CREATE SCHEMA b
GO
EOF
}

function create_tables {
	exec_sql << EOF
CREATE TABLE a.tbl_a (c int, PRIMARY KEY (c))
GO
CREATE TABLE b.tbl_b (c int, PRIMARY KEY (c), FOREIGN KEY (c) REFERENCES a.tbl_a(c))
GO
EOF
}

function schema_spy {
	docker run --rm --net="container:${name}" -v $(pwd):/build \
	    schemaspy:latest \
	    -t mssql05 \
	    -dp /opt/schemaspy/lib/sqljdbc4.jar \
	    -db test \
	    -host localhost \
	    -port 1433 \
	    -all \
	    -u sa \
	    -p "$password" \
	    -o /build
}

start_sql
wait_for_sql
create_db
create_schemas
create_tables
schema_spy

from schemaspy.

rafalkasa avatar rafalkasa commented on May 26, 2024

@kjvalencik thank you very much for script that help reproduce the issue. This is more than appreciated.

from schemaspy.

rafalkasa avatar rafalkasa commented on May 26, 2024

@kjvalencik problem with Cross-Schema Foreign Keys was fixed and will be ready in version 6.0.0-rc1 to this moment in time you need to compile SchemeSpy yourself.

from schemaspy.

kjvalencik avatar kjvalencik commented on May 26, 2024

Confirmed fixed. Thanks! 👍

from schemaspy.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.